jackwener/OpenCLI · error · ArgumentError

Jira --fields auto cannot be combined with other field ids

Error message

Jira --fields auto cannot be combined with other field ids

What it means

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.

Source

Thrown at clis/jira/shared.js:71

    };
}

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)] };
}

function issueFields(extraFields = [], selection = null) {
    if (selection?.mode === 'auto') return '*all';
    if (selection?.mode === 'selected') {
        return [...new Set([...selection.ids, ...extraFields.filter(Boolean)])].join(',');
    }
    const configured = Object.values(configuredFieldNames()).filter(Boolean);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Use --fields=auto alone to get every field.
  2. Or drop 'auto' and list exactly the fields you want: --fields="summary,status".
  3. In scripts, special-case auto: if ids.includes('auto') pass 'auto' alone instead of joining.

Example fix

// before
--fields="auto,summary,status"
// after
--fields="summary,status"  // or: --fields=auto
Defensive patterns

Strategy: validation

Validate before calling

function normalizeFields(raw) {
  const parts = String(raw).split(',').map(s => s.trim());
  if (parts.some(p => p.toLowerCase() === 'auto')) return 'auto';
  return parts.filter(Boolean).join(',');
}

Type guard

const isAutoSelection = (s) => typeof s === 'string' && s.split(',').map(p => p.trim().toLowerCase()).includes('auto');
// if isAutoSelection(raw): pass 'auto' alone

Try / catch

try {
  await run(['jira', 'issue', key, '--fields', fields]);
} catch (e) {
  if (e instanceof ArgumentError && e.message.includes('auto cannot be combined')) {
    console.error('Pass --fields=auto alone, or drop auto and list ids.');
  } else throw e;
}

Prevention

When it happens

Trigger: --fields="auto,summary", --fields="summary,auto", or --fields="AUTO,status" — any combination where auto is one of multiple comma-separated parts.

Common situations: Scripts that append a default 'auto' entry to a user-provided list; users assuming auto means 'also include defaults' rather than 'everything'.

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


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