{"record":{"id":"95ed7ba33b0d90ce","repo":"jackwener/OpenCLI","slug":"invalid-jira-field-id-in-fields","errorCode":null,"errorMessage":"Invalid Jira field id in --fields","messagePattern":"Invalid Jira field id in --fields","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/jira/shared.js","lineNumber":76,"sourceCode":"    if (typeof raw !== 'string') {\n        throw new ArgumentError('Jira --fields must be a comma-separated string or auto');\n    }\n\n    const parts = raw.split(',').map((field) => field.trim());\n    if (parts.length === 0 || parts.some((field) => !field)) {\n        throw new ArgumentError(\n            'Invalid Jira --fields selection',\n            'Use comma-separated field ids without empty entries, for example summary,status,customfield_12345.',\n        );\n    }\n    if (parts.some((field) => field.toLowerCase() === 'auto')) {\n        if (parts.length !== 1) {\n            throw new ArgumentError('Jira --fields auto cannot be combined with other field ids');\n        }\n        return { mode: 'auto' };\n    }\n    if (parts.some((field) => !/^[A-Za-z][A-Za-z0-9_.:-]*$/.test(field))) {\n        throw new ArgumentError(\n            'Invalid Jira field id in --fields',\n            'Use Jira field ids such as summary, status, or customfield_12345.',\n        );\n    }\n    return { mode: 'selected', ids: [...new Set(parts)] };\n}\n\nfunction issueFields(extraFields = [], selection = null) {\n    if (selection?.mode === 'auto') return '*all';\n    if (selection?.mode === 'selected') {\n        return [...new Set([...selection.ids, ...extraFields.filter(Boolean)])].join(',');\n    }\n    const configured = Object.values(configuredFieldNames()).filter(Boolean);\n    return [...new Set([...DEFAULT_ISSUE_FIELDS, ...configured, ...extraFields.filter(Boolean)])].join(',');\n}\n\nexport function issueSelectionIncludes(selection, field) {\n    return selection === null || selection?.mode === 'auto' || selection?.ids?.includes(field) === true;","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jira/shared.js#L58-L94","documentation":"ArgumentError from `parseIssueFieldSelection` in clis/jira/shared.js:76, raised when a --fields entry fails the field-id pattern /^[A-Za-z][A-Za-z0-9_.:-]*$/: it must start with a letter and contain only letters, digits, underscore, dot, colon, or hyphen. This catches malformed Jira field ids before a request is sent.","triggerScenarios":"--fields=\"summary,status!\", entries starting with a digit (e.g. 12345), entries containing spaces, slashes, or CJK characters, or human-readable names like 'Story Points' instead of ids.","commonSituations":"Using a custom field's NAME instead of its id (customfield_12345); translating keys or adding labels; copy-pasting ids with surrounding quotes, spaces, or unicode punctuation from docs.","solutions":["Use the Jira field id, not the display name: customfield_12345 instead of 'Story Points'.","Look up exact ids via /rest/api/3/field or your Jira admin's field list.","Remove spaces/invalid punctuation; allowed chars: letters, digits, _ . : -","Ensure the entry starts with a letter."],"exampleFix":"// before\n--fields=\"summary,Story Points\"\n// after\n--fields=\"summary,customfield_10016\"","handlingStrategy":"validation","validationCode":"const FIELD_ID_RE = /^[A-Za-z][A-Za-z0-9_.:-]*$/;\nfunction assertValidFieldIds(raw) {\n  for (const p of String(raw).split(',')) {\n    if (p.trim() && !FIELD_ID_RE.test(p.trim())) {\n      throw new Error(`--fields entry '${p.trim()}' is not a valid Jira field id`);\n    }\n  }\n  return raw;\n}","typeGuard":"const isFieldId = (s) => typeof s === 'string' && /^[A-Za-z][A-Za-z0-9_.:-]*$/.test(s);","tryCatchPattern":"try {\n  await run(['jira', 'issue', key, '--fields', fields]);\n} catch (e) {\n  if (e instanceof ArgumentError && e.message === 'Invalid Jira field id in --fields') {\n    console.error('Use ids like summary, status, customfield_12345 (see GET /rest/api/3/field).');\n  } else throw e;\n}","preventionTips":["Resolve display names to ids via GET /rest/api/3/field before use.","Reject free-text names in config; allowlist field ids.","Trim and dequote copy-pasted values.","Remember ids start with a letter and contain only [A-Za-z0-9_.:-]."],"tags":["argument-validation","cli","jira","parsing"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}