jackwener/OpenCLI · error · ArgumentError
Invalid Jira --fields selection
Error message
Invalid Jira --fields selection
What it means
ArgumentError from `parseIssueFieldSelection` in clis/jira/shared.js:64, raised when the --fields string, after splitting on ',' and trimming, yields no parts or contains an empty entry (e.g. leading/trailing commas or consecutive commas). Every comma-separated entry must be a non-empty field id.
Source
Thrown at clis/jira/shared.js:64
}
function configuredFieldNames() {
return {
acceptanceCriteria: process.env.ATLASSIAN_JIRA_ACCEPTANCE_FIELD?.trim() || '',
sprint: process.env.ATLASSIAN_JIRA_SPRINT_FIELD?.trim() || '',
storyPoints: process.env.ATLASSIAN_JIRA_STORY_POINTS_FIELD?.trim() || '',
};
}
export function parseIssueFieldSelection(raw) {
if (raw === undefined) return null;
if (typeof raw !== 'string') {
throw new ArgumentError('Jira --fields must be a comma-separated string or auto');
}
const parts = raw.split(',').map((field) => field.trim());
if (parts.length === 0 || parts.some((field) => !field)) {
throw new ArgumentError(
'Invalid Jira --fields selection',
'Use comma-separated field ids without empty entries, for example summary,status,customfield_12345.',
);
}
if (parts.some((field) => field.toLowerCase() === 'auto')) {
if (parts.length !== 1) {
throw new ArgumentError('Jira --fields auto cannot be combined with other field ids');
}
return { mode: 'auto' };
}
if (parts.some((field) => !/^[A-Za-z][A-Za-z0-9_.:-]*$/.test(field))) {
throw new ArgumentError(
'Invalid Jira field id in --fields',
'Use Jira field ids such as summary, status, or customfield_12345.',
);
}
return { mode: 'selected', ids: [...new Set(parts)] };
}View on GitHub (pinned to 49907e53dc)
Solutions
- Remove empty entries: write summary,status instead of summary,,status.
- Strip trailing commas in your script: raw.replace(/,+$/, '') before passing the value.
- Filter empties when building the list programmatically: ids.filter(Boolean).join(',').
Example fix
// before --fields="summary,,status" // after --fields="summary,status"
Defensive patterns
Strategy: validation
Validate before calling
function cleanFieldList(raw) {
return raw.split(',').map(s => s.trim()).filter(Boolean).join(',');
}
// use: --fields=$(cleanFieldList "$RAW") Type guard
const isValidFieldList = (s) => typeof s === 'string' && s.split(',').every(p => p.trim() !== ''); Try / catch
try {
await run(['jira', 'issue', key, '--fields', fields]);
} catch (e) {
if (e instanceof ArgumentError && e.message === 'Invalid Jira --fields selection') {
console.error('Empty entry in --fields; remove dangling/double commas.');
} else throw e;
} Prevention
- Never end a field list with a comma.
- Build lists with ids.filter(Boolean).join(',').
- Lint scripts that assemble field lists for empty segments.
When it happens
Trigger: --fields="summary,,status", --fields=",", --fields=" summary, " with a trailing comma, or whitespace-only entries between commas.
Common situations: Hand-editing a field list and leaving a dangling comma; copy-pasting lists with trailing separators; generated lists from a join where a source field was empty.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Invalid Jira field id in --fields
- Invalid Jira issue key: ${key}
- --${name} must be a positive integer, got ${JSON.stringify(r
- Jira --fields must be a comma-separated string or auto
- Jira --fields auto cannot be combined with other field ids
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/7d2367a70a450dcd.
Report an issue: GitHub.