affaan-m/ECC · error · Error

Missing --title for a new work item.

Error message

Missing --title for a new work item.

What it means

A new work item cannot be created without a title: in buildUpsertPayload, options.title is unset and there is no existing item to inherit a title from, so title resolves falsy.

Solutions

  1. Add --title "<your title>" to the command
  2. If updating an existing item, verify the id exists so its stored title can be reused
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at scripts/work-items.js:325 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/89ac686d348f7eea. Report an issue: GitHub.

Appendix: source

Thrown at scripts/work-items.js:325

    repo,
    syncedAt,
    prCount: prs.length,
    issueCount: issues.length,
    closedCount: closedItems.length,
    items,
    closedItems
  };
}

function buildUpsertPayload(options, existing = null) {
  const id = resolveWorkItemId(options);
  if (!id) {
    throw new Error('Missing work item id. Pass <id> or --id <id>.');
  }

  const title = options.title ?? (existing && existing.title);
  if (!title) {
    throw new Error('Missing --title for a new work item.');
  }

  return {
    id,
    source: options.source ?? (existing && existing.source) ?? 'manual',
    sourceId: options.sourceId ?? (existing && existing.sourceId) ?? null,
    title,
    status: options.status ?? (existing && existing.status) ?? 'open',
    priority: options.priority ?? (existing && existing.priority) ?? null,
    url: options.url ?? (existing && existing.url) ?? null,
    owner: options.owner ?? (existing && existing.owner) ?? null,
    repoRoot: options.repoRoot ?? (existing && existing.repoRoot) ?? process.cwd(),
    sessionId: options.sessionId ?? (existing && existing.sessionId) ?? null,
    metadata: options.metadataJson !== undefined ? parseMetadataJson(options.metadataJson) : ((existing && existing.metadata) ?? null),
    createdAt: existing ? existing.createdAt : undefined,
    updatedAt: new Date().toISOString()
  };
}

View on GitHub (pinned to 8321021c54)