{"record":{"id":"5bcc0c1cd22ec263","repo":"jackwener/OpenCLI","slug":"commandname-requires-execute-to-perform-a-rem","errorCode":null,"errorMessage":"${commandName} requires --execute to perform a remote write","messagePattern":"(.+?) requires --execute to perform a remote write","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/_atlassian/shared.js","lineNumber":288,"sourceCode":"    if (!rows.length) throw new EmptyResultError(label, hint);\n    return rows;\n}\n\nexport function parseLimit(value, defaultValue = 20, maxValue = 100, label = 'limit') {\n    const raw = value ?? defaultValue;\n    const n = typeof raw === 'number' ? raw : Number(raw);\n    if (!Number.isInteger(n) || n <= 0) {\n        throw new ArgumentError(`${label} must be a positive integer`);\n    }\n    if (n > maxValue) {\n        throw new ArgumentError(`${label} must be <= ${maxValue}`);\n    }\n    return n;\n}\n\nexport function requireExecute(args, commandName) {\n    if (args.execute !== true) {\n        throw new ArgumentError(`${commandName} requires --execute to perform a remote write`);\n    }\n}\n\nexport async function readUtf8File(filePath) {\n    const path = requireString(filePath, '--file');\n    let fileStat;\n    try {\n        fileStat = await stat(path);\n    } catch {\n        throw new ArgumentError(`File not found: ${path}`);\n    }\n    if (!fileStat.isFile()) {\n        throw new ArgumentError(`File must be a readable text file: ${path}`);\n    }\n    let raw;\n    try {\n        raw = await readFile(path);\n    } catch {","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/_atlassian/shared.js#L270-L306","documentation":"requireExecute is a safety gate for CLI commands that would perform a remote (write) operation against an Atlassian API. It throws ArgumentError when the --execute flag was not passed, ensuring destructive or state-changing commands never run implicitly. This prevents accidental remote writes from a dry-run/default invocation.","triggerScenarios":"Calling any command wired to requireExecute without passing --execute (i.e. args.execute is not exactly true), e.g. `cli update-issue ...` instead of `cli update-issue ... --execute`.","commonSituations":"Running a write command from a script or CI job where the flag was omitted; assuming the command would prompt for confirmation instead; flags parsed as strings ('--execute' present but value is a string, not boolean true).","solutions":["Re-run the command with the --execute flag to explicitly authorize the remote write.","Verify your argument parser converts --execute to a boolean true (not a string), since the check is strict equality with true.","Wrap in try-catch for ArgumentError to print a hint about --execute in scripts."],"exampleFix":"// before\ncli confluence update-page --id 12345 --file page.md\n// after\ncli confluence update-page --id 12345 --file page.md --execute","handlingStrategy":"validation","validationCode":"if (args.execute !== true) {\n  console.error(`Refusing remote write: re-run with --execute`);\n  process.exit(1);\n}","typeGuard":"const isExecuteAuthorized = (args) => args.execute === true;","tryCatchPattern":"try {\n  await runWriteCommand(args);\n} catch (err) {\n  if (err.name === 'ArgumentError' && err.message.includes('--execute')) {\n    console.error('Dry run blocked: add --execute to apply changes remotely.');\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Always append --execute to write commands in scripts/CI.","Keep dry-run as the default and only add --execute after reviewing the plan output.","Ensure your argv parser stores flags as boolean true, not strings."],"tags":["cli","argument-validation","safety-guard","remote-write"],"backgroundTag":"missing-required-flag","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}