{"record":{"id":"8bab601aa8680b59","repo":"nanocoai/nanoclaw","slug":"def-name-not-found-id","errorCode":null,"errorMessage":"${def.name} not found: ${id}","messagePattern":"(.+?) not found: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/crud.ts","lineNumber":222,"sourceCode":"        params.push(coerceListFilter(column, v));\n      }\n    }\n    const where = filters.length > 0 ? ` WHERE ${filters.join(' AND ')}` : '';\n    params.push(limit);\n    // Newest first: without an ORDER BY the LIMIT silently hides the most\n    // recently inserted rows once a table outgrows it (bit `sessions list`\n    // past 200 sessions — a just-created session was invisible).\n    return getDb().all(`SELECT ${cols} FROM ${def.table}${where} ORDER BY ${listOrder(def)} LIMIT ?`, ...params);\n  };\n}\n\nfunction genericGet(def: ResourceDef) {\n  const cols = visibleColumns(def).join(', ');\n  return async (args: Record<string, unknown>) => {\n    const id = args.id as string;\n    if (!id) throw new Error(`${def.name} id is required`);\n    const row = await getDb().get(`SELECT ${cols} FROM ${def.table} WHERE ${def.idColumn} = ?`, id);\n    if (!row) throw new Error(`${def.name} not found: ${id}`);\n    return row;\n  };\n}\n\nfunction genericCreate(def: ResourceDef) {\n  return async (args: Record<string, unknown>) => {\n    const values: Record<string, unknown> = {};\n\n    // Pass 1: generated columns + explicit caller args only. Static defaults\n    // wait until after resolveDefaults so the hook sees exactly what the\n    // caller provided and a static default never pre-empts context-aware\n    // resolution.\n    for (const col of def.columns) {\n      if (col.generated) {\n        if (col.name === def.idColumn) {\n          values[col.name] = randomUUID();\n        } else if (col.name.endsWith('_at')) {\n          values[col.name] = new Date().toISOString();","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/crud.ts#L204-L240","documentation":"Thrown by genericGet in src/cli/crud.ts when a SELECT by the resource's idColumn returns no row — the requested record does not exist in the central DB. The id was provided but matched nothing.","triggerScenarios":"`ncl <resource> get --id <id>` where no row has that id: typo'd id, deleted record, or the wrong install's DB (socket points at another copy).","commonSituations":"Using an id copied from another NanoClaw install; record was deleted by another admin; slug vs internal id confusion.","solutions":["List ids to confirm: `ncl <resource> list`","Check for typos / trailing whitespace in the id","Verify you're connected to the right install (ncl goes over the Unix socket of the running host)"],"exampleFix":"# before\nncl groups get --id mygroup\n# after\nncl groups list   # find the real id\nncl groups get --id my-group","handlingStrategy":"try-catch","validationCode":"const exists = await runNcl([resource, 'list', '--json']);\nif (!exists.some(r => r[idColumn] === id)) skip();","typeGuard":null,"tryCatchPattern":"try { const row = await getResource(id); } catch (e) { if ((e as Error).message.includes('not found')) return null; throw e; }","preventionTips":["Cache ids from list output rather than hardcoding","Treat 'not found' as a benign branch in automation, not a crash"],"tags":["cli","not-found","crud"],"backgroundTag":"record-not-found","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}