jackwener/OpenCLI · error · CommandExecutionError

${label} did not include a stable ${field}.

Error message

${label} did not include a stable ${field}.

What it means

requirePayloadString throws this when the field that should hold a stable identifier (page id, issue key, etc.) is absent or of an unexpected type (not string/number). The CLI needs a stable key to reference the resource, so it refuses to continue rather than returning a record without one.

Source

Thrown at clis/_atlassian/shared.js:262

}

export function requirePayloadObject(value, label) {
    if (!value || typeof value !== 'object' || Array.isArray(value)) {
        throw new CommandExecutionError(`${label} returned an unexpected payload shape; expected an object.`);
    }
    return value;
}

export function requirePayloadArray(value, label) {
    if (!Array.isArray(value)) {
        throw new CommandExecutionError(`${label} returned an unexpected payload shape; expected an array.`);
    }
    return value;
}

export function requirePayloadString(value, field, label) {
    if (typeof value !== 'string' && typeof value !== 'number') {
        throw new CommandExecutionError(`${label} did not include a stable ${field}.`);
    }
    const s = String(value).trim();
    if (!s) throw new CommandExecutionError(`${label} did not include a stable ${field}.`);
    return s;
}

export function requireNonEmptyRows(rows, label, hint) {
    if (!rows.length) throw new EmptyResultError(label, hint);
    return rows;
}

export function parseLimit(value, defaultValue = 20, maxValue = 100, label = 'limit') {
    const raw = value ?? defaultValue;
    const n = typeof raw === 'number' ? raw : Number(raw);
    if (!Number.isInteger(n) || n <= 0) {
        throw new ArgumentError(`${label} must be a positive integer`);
    }
    if (n > maxValue) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Inspect the raw response and confirm which field carries the ID; the field name or nesting may differ between Cloud and Data Center.
  2. Re-run with expanded/other fields enabled if the endpoint requires requesting the ID explicitly (e.g. CQL/JQL field lists).
  3. Check whether the resource type returned actually has this identifier (some result types use contentId vs id).
  4. Update the adapter/CLI version if Atlassian renamed the field in a newer REST version.

Example fix

// before (field list omits id in JQL)
searchJql('project = DEMO', fields: ['summary'])
// after
searchJql('project = DEMO', fields: ['summary', 'key', 'id'])
Defensive patterns

Strategy: validation

Validate before calling

function requireId(record, fields = ['id', 'key', 'contentId']) {
  for (const f of fields) {
    const v = record?.[f];
    if (typeof v === 'string' || typeof v === 'number') return String(v);
  }
  throw new Error(`Record lacks a stable identifier (looked for: ${fields.join(', ')})`);
}

Type guard

function hasStableId(v) { return (typeof v === 'string' || typeof v === 'number') && String(v).trim() !== ''; }

Try / catch

try {
  const rows = await searchCmd(args);
} catch (e) {
  if (/did not include a stable/.test(e.message)) {
    console.error('Response lacked the id/key field — request it explicitly or check deployment/API version.');
  } else throw e;
}

Prevention

When it happens

Trigger: API payload omits the id/key field (e.g. expanded fields not requested, or a different object type returned); the field is a nested object ({id:{...}}) instead of a scalar; response came from the wrong endpoint or a deleted/moved resource stub.

Common situations: Data Center vs Cloud responses keying IDs differently; requesting search results where some entries (archived, restricted) lack the id field; Atlassian deprecating a field in a newer API version.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/bcf1b1a204a6ceae. Report an issue: GitHub.