nanocoai/nanoclaw · error · Error

--threads must be true or false, got "${v}"

Error message

--threads must be true or false, got "${v}"

What it means

normalizeThreads only accepts true/false (booleans, or the strings/numbers '1'/'0'); anything else throws. The value is stored as INTEGER 1/0 on the wiring, NULL meaning inherit the channel declaration.

Source

Thrown at src/cli/resources/wirings.ts:45

const CREATE_ENUMS: Record<string, string[]> = {
  engage_mode: ['pattern', 'mention', 'mention-sticky'],
  sender_scope: ['all', 'known'],
  ignored_message_policy: ['drop', 'accumulate'],
  session_mode: ['shared', 'per-thread', 'agent-shared'],
};

async function requireMessagingGroup(id: unknown): Promise<MessagingGroup> {
  const mg = await getMessagingGroup(String(id));
  if (!mg) throw new Error(`messaging group not found: ${id}`);
  return mg;
}

/** --threads accepts true/false (or 1/0); stored as INTEGER 1/0. Omitted =
 *  column NULL = inherit the channel declaration. */
function normalizeThreads(v: unknown): number {
  if (v === true || v === 'true' || v === '1' || v === 1) return 1;
  if (v === false || v === 'false' || v === '0' || v === 0) return 0;
  throw new Error(`--threads must be true or false, got "${v}"`);
}

registerResource({
  name: 'wiring',
  plural: 'wirings',
  table: 'messaging_group_agents',
  description:
    'Wiring — connects a messaging group to an agent group. Determines which agent handles messages from which chat. The same messaging group can be wired to multiple agents; the same agent can be wired to multiple messaging groups.',
  idColumn: 'id',
  scopeField: 'agent_group_id',
  columns: [
    { name: 'id', type: 'string', description: 'UUID.', generated: true },
    {
      name: 'messaging_group_id',
      type: 'string',
      description: 'The chat/channel to route from. References messaging_groups.id.',
      required: true,
    },

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Use --threads true or --threads false (1/0 also accepted)
  2. Omit --threads entirely to inherit the channel declaration

Example fix

# before
ncl wirings create ... --threads yes
# after
ncl wirings create ... --threads true
Defensive patterns

Strategy: validation

Validate before calling

const ok = ['true','false','1','0'].includes(String(v));
if (!ok) throw new Error('pass --threads true|false');

Type guard

function isThreadsFlag(v: unknown): boolean {
  return [true,false,'true','false',1,0,'1','0'].includes(v as any);
}

Prevention

When it happens

Trigger: ncl wirings create ... --threads yes / --threads on / --threads 2 — any value outside true|false|1|0 (as bool, string, or number).

Common situations: Passing common truthy spellings like 'yes','on','enable', or passing 'True' capitalized.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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