{"record":{"id":"5fd94fedb65cc22d","repo":"can1357/oh-my-pi","slug":"setup-check-json-requires-a-component-python","errorCode":null,"errorMessage":"setup --check/--json requires a COMPONENT (python|speech)","messagePattern":"setup --check/--json requires a COMPONENT \\(python\\|speech\\)","errorType":"validation","errorClass":"CliUsageError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/commands/setup.ts","lineNumber":55,"sourceCode":"\t\t\tdescription: \"Optional component to install\",\n\t\t\trequired: false,\n\t\t\toptions: COMPONENTS,\n\t\t}),\n\t};\n\n\tstatic flags = {\n\t\tcheck: Flags.boolean({ char: \"c\", description: \"Check if dependencies are installed\" }),\n\t\tjson: Flags.boolean({ description: \"Output status as JSON\" }),\n\t};\n\n\tasync run(): Promise<void> {\n\t\tconst { args, flags } = await this.parse(Setup);\n\t\tif (!args.component) {\n\t\t\tif (flags.check || flags.json) {\n\t\t\t\t// A check/JSON request with no COMPONENT has nothing to probe. Emit a\n\t\t\t\t// usage error on stderr (exit 1) rather than printing help to stdout at\n\t\t\t\t// exit 0, which would mask failures in scripted `--json` health checks.\n\t\t\t\tthrow new CliUsageError(\"setup --check/--json requires a COMPONENT (python|speech)\");\n\t\t\t}\n\t\t\tawait runOnboardingSetup();\n\t\t\treturn;\n\t\t}\n\t\tconst cmd: SetupCommandArgs = {\n\t\t\tcomponent: args.component as SetupComponent,\n\t\t\tflags: {\n\t\t\t\tjson: flags.json,\n\t\t\t\tcheck: flags.check,\n\t\t\t},\n\t\t};\n\t\tawait initTheme();\n\t\tawait runSetupCommand(cmd);\n\t}\n}\n","sourceCodeStart":37,"sourceCodeEnd":71,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/commands/setup.ts#L37-L71","documentation":"omp setup's --check and --json flags interrogate a specific COMPONENT (python or speech). Without a component there is nothing to probe, so the command throws a CliUsageError (exiting 1 to stderr) rather than printing help at exit 0 — this keeps scripted --json health checks from silently 'succeeding'.","triggerScenarios":"Running 'omp setup --check' or 'omp setup --json' with no COMPONENT argument; CI scripts templated with an empty component variable.","commonSituations":"Health-check scripts calling setup --json expecting machine output but forgetting which component to probe; shell variable for the component left empty.","solutions":["Specify the component: omp setup --check python or omp setup --json speech","Fix the CI/script variable that supplies COMPONENT so it is non-empty","If you only wanted interactive setup, run plain 'omp setup' with no flags"],"exampleFix":"// before\nomp setup --check\n// after\nomp setup --check python","handlingStrategy":"validation","validationCode":"if ((flags.check || flags.json) && !component) {\n  throw new Error('setup --check/--json requires a COMPONENT (python|speech)');\n}","typeGuard":"function isSetupComponent(c) { return c === 'python' || c === 'speech'; }","tryCatchPattern":"try {\n  await Setup.run(rawArgs);\n} catch (err) {\n  if (err instanceof CliUsageError && err.message.includes('requires a COMPONENT')) {\n    console.error('Usage: omp setup --check|--json <python|speech>');\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Always pass the component with --check/--json in scripts","Fail fast on empty component variables in CI templates","Use plain 'omp setup' for interactive onboarding, flags only for scripted checks"],"tags":["cli","usage","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}