jackwener/OpenCLI · error · CommandExecutionError
jira issue ${key} did not return requested field ${id}.
Error message
jira issue ${key} did not return requested field ${id}. What it means
CommandExecutionError from `selectedFieldRows` in clis/jira/shared.js:185, thrown while normalizing a fetched issue when one of the explicitly selected --fields ids is absent from the issue's `fields` object (checked with hasOwnProperty, so a null value is fine but a missing key is not). The Jira API omits fields that don't exist on the instance or aren't applicable, so this indicates a mismatch between what you asked for and what the issue carries.
Source
Thrown at clis/jira/shared.js:185
function customValueToMarkdown(value) {
if (!value) return '';
if (typeof value === 'string') return value.trim();
if (value && typeof value === 'object' && value.type === 'doc') return adfToMarkdown(value);
if (Array.isArray(value)) return value.map(valueName).filter(Boolean).join(', ');
return valueName(value);
}
function inlineComments(fields, key, options) {
if (options.comments !== undefined) return requirePayloadArray(options.comments, `jira issue ${key} comments`);
const commentBlock = requirePayloadObject(fields.comment, `jira issue ${key} comment field`);
return requirePayloadArray(commentBlock.comments, `jira issue ${key} comment field comments`);
}
function selectedFieldRows(fields, names, selection, key) {
const ids = selection.mode === 'auto' ? Object.keys(fields).sort() : selection.ids;
return ids.map((id) => {
if (!Object.prototype.hasOwnProperty.call(fields, id)) {
throw new CommandExecutionError(`jira issue ${key} did not return requested field ${id}.`);
}
const name = typeof names[id] === 'string' && names[id].trim() ? names[id].trim() : id;
return { id, name, value: fields[id] };
});
}
export function normalizeJiraIssue(issue, config, options = {}) {
const row = requirePayloadObject(issue, 'jira issue');
const key = requirePayloadString(row.key, 'issue key', 'jira issue');
const fields = requirePayloadObject(row.fields, `jira issue ${key} fields`);
const rendered = row.renderedFields && typeof row.renderedFields === 'object' && !Array.isArray(row.renderedFields)
? row.renderedFields
: {};
const selection = options.selection ?? null;
const custom = configuredFieldNames();
const includeComments = options.requireNestedCollections !== false && issueSelectionIncludes(selection, 'comment');
const includeAttachments = options.requireNestedCollections !== false && issueSelectionIncludes(selection, 'attachment');
const includeIssueLinks = options.requireNestedCollections !== false && issueSelectionIncludes(selection, 'issuelinks');View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the field id exists on this Jira instance via GET /rest/api/3/field and correct it.
- Remove the offending id from --fields, or use --fields=auto to see everything the issue returns.
- Note the difference between a null value (OK) and an omitted key (this error) — null fields are returned, missing ones are not.
- If migrating between Jira sites, remap customfield ids; they are instance-specific.
- Guard scripts: fetch the field list first and intersect it with your desired ids.
Example fix
// before --fields="summary,customfield_99999" // id from old instance // after --fields="summary,customfield_10016" // id confirmed via GET /rest/api/3/field
Defensive patterns
Strategy: try-catch
Validate before calling
// Intersect desired ids with fields that actually exist on the instance: const available = new Set((await fetchFields()).map(f => f.id)); const safe = ids.filter(id => available.has(id)); const dropped = ids.filter(id => !available.has(id)); // warn about dropped ids
Type guard
function issueHasField(issue, id) {
return Boolean(issue && issue.fields && Object.prototype.hasOwnProperty.call(issue.fields, id));
} Try / catch
import { CommandExecutionError } from '@jackwener/opencli/errors';
try {
const issue = await getJiraIssue(key, fields);
} catch (e) {
if (e instanceof CommandExecutionError && /did not return requested field/.test(e.message)) {
const id = e.message.match(/field (\S+)\.$/)?.[1];
console.warn(`Field ${id} missing on this issue/instance; retrying without it.`);
return getJiraIssue(key, fields.filter(f => f !== id));
}
throw e;
} Prevention
- Verify customfield ids against the target instance (GET /rest/api/3/field); ids are instance-specific.
- Re-map ids after Jira Cloud/Server migrations.
- Prefer --fields=auto when unsure what the issue returns.
- Remember null values are valid; only omitted keys trigger this error.
When it happens
Trigger: --fields=customfield_99999 where the custom field doesn't exist in that Jira site; requesting a field type not applicable to that issue type (e.g. sprint on a non-software project); a typo'd id; a field removed or renamed after Jira migration.
Common situations: Hardcoded customfield ids from another Jira instance (ids differ per site); scripted field lookups after a Cloud/Server migration; atllassian_JIRA_* env vars pointing at non-existent field ids that get requested but dropped.
Related errors
- archive item returned malformed payload: files must be an ar
- archive search failed: HTTP ${resp.status}
- archive search returned malformed payload: response.docs mus
- hf spaces failed: HTTP ${resp.status}
- FETCH_ERROR
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c9b9f937a29691e9.
Report an issue: GitHub.