{"record":{"id":"0005bda717f2c9b9","repo":"jackwener/OpenCLI","slug":"jira-fields-auto-cannot-be-combined-with-other-f","errorCode":null,"errorMessage":"Jira --fields auto cannot be combined with other field ids","messagePattern":"Jira --fields auto cannot be combined with other field ids","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/jira/shared.js","lineNumber":71,"sourceCode":"    };\n}\n\nexport function parseIssueFieldSelection(raw) {\n    if (raw === undefined) return null;\n    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);","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jira/shared.js#L53-L89","documentation":"ArgumentError from `parseIssueFieldSelection` in clis/jira/shared.js:71, raised when 'auto' (case-insensitive) appears in --fields together with any other field id. 'auto' is a mode selector meaning 'request all fields (*all)', so it is mutually exclusive with an explicit id list; mixing them is ambiguous.","triggerScenarios":"--fields=\"auto,summary\", --fields=\"summary,auto\", or --fields=\"AUTO,status\" — any combination where auto is one of multiple comma-separated parts.","commonSituations":"Scripts that append a default 'auto' entry to a user-provided list; users assuming auto means 'also include defaults' rather than 'everything'.","solutions":["Use --fields=auto alone to get every field.","Or drop 'auto' and list exactly the fields you want: --fields=\"summary,status\".","In scripts, special-case auto: if ids.includes('auto') pass 'auto' alone instead of joining."],"exampleFix":"// before\n--fields=\"auto,summary,status\"\n// after\n--fields=\"summary,status\"  // or: --fields=auto","handlingStrategy":"validation","validationCode":"function normalizeFields(raw) {\n  const parts = String(raw).split(',').map(s => s.trim());\n  if (parts.some(p => p.toLowerCase() === 'auto')) return 'auto';\n  return parts.filter(Boolean).join(',');\n}","typeGuard":"const isAutoSelection = (s) => typeof s === 'string' && s.split(',').map(p => p.trim().toLowerCase()).includes('auto');\n// if isAutoSelection(raw): pass 'auto' alone","tryCatchPattern":"try {\n  await run(['jira', 'issue', key, '--fields', fields]);\n} catch (e) {\n  if (e instanceof ArgumentError && e.message.includes('auto cannot be combined')) {\n    console.error('Pass --fields=auto alone, or drop auto and list ids.');\n  } else throw e;\n}","preventionTips":["Treat 'auto' as a standalone mode, never an entry in a list.","In scripts, special-case auto before joining id arrays.","Document that auto requests *all fields (replaces, not augments, the list)."],"tags":["argument-validation","cli","jira"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}