jackwener/OpenCLI · error · ArgumentError

claude detail requires a conversation id

Error message

claude detail requires a conversation id

What it means

requireConversationId validates that a conversation id was supplied for commands that inspect a specific conversation (e.g. `opencli claude detail`). The id is required to locate the conversation, so a missing/empty value throws this ArgumentError with a usage example.

Source

Thrown at clis/claude/utils.js:90

        throw new ArgumentError(
            `${commandName} prompt cannot be empty`,
            `Example: opencli ${commandName} "hello"`,
        );
    }
    return text;
}

export function requirePositiveInt(value, flagLabel, hint) {
    if (!Number.isInteger(value) || value < 1) {
        throw new ArgumentError(`${flagLabel} must be a positive integer`, hint);
    }
    return value;
}

export function requireConversationId(value) {
    const id = String(value ?? '').trim();
    if (!id) {
        throw new ArgumentError(
            'claude detail requires a conversation id',
            'Example: opencli claude detail 123e4567-e89b-12d3-a456-426614174000',
        );
    }
    return id;
}

export async function getVisibleMessages(page) {
    const result = await page.evaluate(`(() => {
        var nodes = document.querySelectorAll('[data-testid="user-message"], ${MESSAGE_SELECTOR}');
        var rows = [];
        Array.from(nodes).forEach(function(el) {
            var isUser = el.getAttribute('data-testid') === 'user-message';
            var raw = (el.innerText || '').trim();
            if (!isUser) {
                var parts = raw.split(/\\n\\n+/);
                while (parts.length > 1 && /^(Thought|View)\\b/i.test(parts[0])) parts.shift();
                raw = parts.join('\\n\\n').trim();

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Supply the conversation id: `opencli claude detail 123e4567-...`
  2. Run `opencli claude list` first to obtain a valid conversation id
  3. Fix the script so the id variable is captured from the prior command's output

Example fix

// before
const id = process.env.CONV_ID; // undefined
await detailCommand({ id: requireConversationId(id) });
// after
const id = await listCommand().then(r => r[0].id);
await detailCommand({ id: requireConversationId(id) });
Defensive patterns

Strategy: validation

Validate before calling

const id = String(process.argv[3] ?? '').trim();
if (!id) {
  console.error('Usage: opencli claude detail <conversation-id>');
  process.exit(2);
}

Type guard

function isConversationId(v) {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

try {
  await detailCommand({ id });
} catch (e) {
  if (e instanceof ArgumentError && e.message.includes('requires a conversation id')) {
    console.error('Supply an id from `opencli claude list`');
    process.exitCode = 2;
  } else throw e;
}

Prevention

When it happens

Trigger: Running `opencli claude detail` with no positional id argument, or with an empty/whitespace value from an unset variable.

Common situations: Scripting where the id comes from a previous command whose output was not captured, forgetting the positional argument, confusing detail with the list command.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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