soma.cell

E0008: shard_not_found

E0008 shard_not_found — the scale section shards a slot the cell does not declare.

A compile-time error of soma check, the checker of the Soma programming language (soma explain E0008).

The rule

The shard: line of a cell's scale section must name one of the cell's memory slots. soma check refuses a shard target that no slot declares (here the typo job for the slot jobs), since there would be nothing to partition. Correct the name to an existing slot, or add the slot.

A program that triggers it

wrong.cell

cell JobQueue {
    memory {
        jobs: Map<String, String> [persistent, consistent]
    }
    scale {
        replicas: 3
        shard: job
        consistency: strong
    }
    on enqueue(id: String, payload: String) {
        jobs.set(id, payload)
    }
}

What soma check prints:

$ soma check wrong.cell
error: scale: shard 'job' is not a declared memory slot in cell 'JobQueue'
  --> wrong.cell:5:5
  |
5 |     scale {
  |     ^
  = code: E0008
✗ 1 error(s), 0 warning(s).

The fix field of soma check --json: Either add a memory slot named 'job' to cell 'JobQueue', or change the shard target in the scale section to match an existing slot.

On line 7, shard: job becomes shard: jobs.

wrong.cell → right.cell

--- wrong.cell
+++ right.cell
@@ -5,5 +5,5 @@
     scale {
         replicas: 3
-        shard: job
+        shard: jobs
         consistency: strong
     }

With the fix, soma check accepts the program:

$ soma check right.cell
✓ All checks passed.