affaan-m/ECC · error · Error
Missing work item id.
Error message
Missing work item id.
What it means
Thrown by the 'show' command branch when resolveWorkItemId(options) returns null. Show fetches a single item by id from the SQLite store, so it cannot operate without one. Unlike the upsert message (481), this one is terse ('Missing work item id.') because show has no --id-or-title alternative to recommend.
Source
Thrown at scripts/work-items.js:438
store = await createStateStore({
dbPath: options.dbPath,
homeDir: process.env.HOME || os.homedir()
});
if (options.command === 'list') {
const payload = store.listWorkItems({ limit: normalizeLimit(options.limit) });
if (options.json) {
console.log(JSON.stringify(payload, null, 2));
} else {
printWorkItemList(payload);
}
return;
}
if (options.command === 'show') {
const id = resolveWorkItemId(options);
if (!id) {
throw new Error('Missing work item id.');
}
const item = store.getWorkItemById(id);
if (!item) {
throw new Error(`Work item not found: ${id}`);
}
if (options.json) {
console.log(JSON.stringify(item, null, 2));
} else {
printWorkItem(item);
}
return;
}
if (options.command === 'upsert') {
const id = resolveWorkItemId(options);
const existing = id ? store.getWorkItemById(id) : null;
const item = store.upsertWorkItem(buildUpsertPayload(options, existing));
if (options.json) {View on GitHub (pinned to 01e15490f0)
Solutions
- Pass the id positionally: `node scripts/work-items.js show my-item`.
- Or use --id: `node scripts/work-items.js show --id my-item`.
- If you only know the source id, first run `list` to find the local id.
Example fix
// before node scripts/work-items.js show // after node scripts/work-items.js show refactor-state-store
Defensive patterns
Strategy: validation
Validate before calling
function ensureShowId(options) {
const id = options.id || (options.positionals && options.positionals[0]);
if (!id) throw new Error('show needs <id> or --id <id>');
return id;
} Type guard
function hasWorkItemId(options) {
return Boolean(options && (options.id || (options.positionals && options.positionals[0])));
} Prevention
- Always pass the id positionally or via --id for show.
- If you only know a source id, run list first to find the local id.
- Validate the id is non-empty before invoking show in scripts.
When it happens
Trigger: Running `node scripts/work-items.js show` with no positional id and no --id flag. Passing the id via an unsupported flag (e.g. --source-id) does not count, since resolveWorkItemId only reads options.id and options.positionals[0].
Common situations: Running show with no arguments; assuming --source-id or --url identifies the item; copy-paste that drops the trailing id.
Related errors
- Missing work item id. Pass <id> or --id <id>.
- Missing issue number.
- Missing --repo <owner/repo>.
- Missing GitHub repo. Pass --repo <owner/repo>.
- Missing --title for a new work item.
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/1f2b52597bb2b94b.
Report an issue: GitHub.