{"record":{"id":"84a3e78493272854","repo":"slopus/happy","slug":"unexpected-arguments-for-happy-resume-args-slic","errorCode":null,"errorMessage":"Unexpected arguments for happy resume: ${args.slice(1).join(' ')}","messagePattern":"Unexpected arguments for happy resume: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/happy-cli/src/resume/handleResumeCommand.ts","lineNumber":34,"sourceCode":"\nexport type ResumeLaunchOptions = {\n    claudeStartingMode?: 'local' | 'remote';\n    startedBy?: 'daemon' | 'terminal';\n};\n\nexport function parseResumeCommandArgs(args: string[]): { showHelp: boolean; sessionId: string } {\n    if (args.includes('-h') || args.includes('--help')) {\n        return {\n            showHelp: true,\n            sessionId: '',\n        };\n    }\n\n    if (args.length === 0) {\n        throw new Error('Happy session ID is required: happy resume <session-id>');\n    }\n    if (args.length > 1) {\n        throw new Error(`Unexpected arguments for happy resume: ${args.slice(1).join(' ')}`);\n    }\n\n    return {\n        showHelp: false,\n        sessionId: args[0],\n    };\n}\n\nfunction resolveFlavor(metadata: Metadata): 'codex' | 'claude' | null {\n    if (metadata.flavor === 'codex' || metadata.codexThreadId) {\n        return 'codex';\n    }\n    if (metadata.flavor === 'claude' || metadata.claudeSessionId) {\n        return 'claude';\n    }\n    return null;\n}\n","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/slopus/happy/blob/b824cd0a4681d41af631a8e422a813873e4455b0/packages/happy-cli/src/resume/handleResumeCommand.ts#L16-L52","documentation":"This error is thrown by parseResumeCommandArgs when `happy resume` is invoked with more than one positional argument. The command accepts exactly one argument — the session ID — and any extra trailing arguments make the invocation ambiguous, so the CLI refuses to run and echoes the offending arguments back.","triggerScenarios":"Running `happy resume <session-id> extra-arg` — args.length > 1 after the 'resume' subcommand is stripped. E.g. pasting a session ID with trailing whitespace-split tokens, passing flags intended for the spawned CLI (claude/codex) directly to `happy resume`, or shell-completing into multiple IDs.","commonSituations":"Users copy a command from docs like `happy resume abc123 --resume` thinking flags pass through; shell history expansion or quoting mistakes split one ID into two tokens; muscle memory from `claude --resume` style syntax.","solutions":["Invoke with exactly one argument: `happy resume <session-id>`","If you meant to pass flags to the underlying claude/codex process, they are not supported here — run `happy resume <session-id>` and use the spawned CLI's own flags inside it","Quote the session ID if it contains characters your shell may split","Run `happy resume` with no args or `--help` to see formatResumeHelp usage text"],"exampleFix":"// before\nhappy resume abc123 --dangerously-skip-permissions\n// after\nhappy resume abc123","handlingStrategy":"validation","validationCode":"const args = process.argv.slice(3);\nif (args.length !== 1) {\n  console.error('Usage: happy resume <session-id>');\n  process.exit(1);\n}\nconst [sessionId] = args;","typeGuard":null,"tryCatchPattern":"try {\n  await handleResumeCommand(rawArgs);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unexpected arguments for happy resume')) {\n    console.error(e.message + '\\n' + formatResumeHelp());\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Pass exactly one positional argument to happy resume","Quote session IDs in the shell to avoid token splitting","Consult `happy resume --help` for accepted arguments","Do not expect pass-through flags to the spawned claude/codex process"],"tags":["cli","argument-validation","resume"],"backgroundTag":"invalid-cli-argument","analyzedSha":"b824cd0a4681d41af631a8e422a813873e4455b0","analyzedAt":"2026-08-31T23:12:36.205Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}