nanocoai/nanoclaw · error

${col.name} must be one of: ${col.enum.join(', ')}

Error message

${col.name} must be one of: ${col.enum.join(', ')}

What it means

Thrown by genericCreate in src/cli/crud.ts during pass-1 column validation when a create argument's value is not in the column's declared enum list. Resource definitions may restrict a column to a fixed set of allowed strings, and any value outside that set is rejected before the INSERT.

Source

Thrown at src/cli/crud.ts:248

    // Pass 1: generated columns + explicit caller args only. Static defaults
    // wait until after resolveDefaults so the hook sees exactly what the
    // caller provided and a static default never pre-empts context-aware
    // resolution.
    for (const col of def.columns) {
      if (col.generated) {
        if (col.name === def.idColumn) {
          values[col.name] = randomUUID();
        } else if (col.name.endsWith('_at')) {
          values[col.name] = new Date().toISOString();
        }
        continue;
      }

      const v = args[col.name];
      if (v !== undefined) {
        if (col.enum && !col.enum.includes(String(v))) {
          throw new Error(`${col.name} must be one of: ${col.enum.join(', ')}`);
        }
        values[col.name] = col.type === 'number' ? Number(v) : v;
      } else if (col.required) {
        throw new Error(`--${col.name.replace(/_/g, '-')} is required`);
      }
    }

    // Pass 2: context-aware defaults + cross-column validation.
    if (def.resolveDefaults) def.resolveDefaults(values);

    // Pass 3: static defaults for whatever is still unset.
    for (const col of def.columns) {
      if (col.generated || values[col.name] !== undefined) continue;
      if (col.default !== undefined) {
        values[col.name] = col.default;
      } else if (col.defaultFrom !== undefined && values[col.defaultFrom] !== undefined) {
        values[col.name] = values[col.defaultFrom];
      }

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Read the error message — it lists every allowed value
  2. Run `ncl <resource> help` to see the column's accepted values
  3. If you expected the value to exist, update your checkout (values come from src/cli/resources/ definitions)

Example fix

# before
ncl wirings create --session-mode solo ...
# after
ncl wirings create --session-mode shared ...   # use a listed value
Defensive patterns

Strategy: validation

Validate before calling

const allowed = def.columns.find(c => c.name === col)!.enum;
if (!allowed.includes(String(value))) throw new Error(`use one of ${allowed.join(', ')}`);

Type guard

const inEnum = (v: unknown, allowed: string[]) => allowed.includes(String(v));

Prevention

When it happens

Trigger: `ncl <resource> create --<enum-column> <bad-value>` e.g. creating a wiring with an unknown session_mode or engage_mode not in the enum defined in src/cli/resources/.

Common situations: Version drift: a valid value in an older NanoClaw was removed/renamed; guessing enum values instead of checking `ncl <resource> help`.

Related errors


AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28). Data as JSON: /api/errors/53ee52c3fc356067. Report an issue: GitHub.