Yeachan-Heo/oh-my-codex · error · Error
--write is only supported with omx adapt <target> init
Error message
--write is only supported with omx adapt <target> init
What it means
The `--write` flag is only meaningful for `omx adapt <target> init`, which materializes files. Passing it with any other subcommand (e.g. probe) is rejected because there is nothing to write. This is a usage guard, not a runtime failure.
Source
Thrown at src/cli/adapt.ts:162
if (!descriptor) {
throw new Error(
`Unknown adapt target: ${target}. Supported targets: ${supportedAdaptTargets().join(", ")}`,
);
}
if (!subcommand) {
stdout(targetHelp(descriptor.target));
return;
}
if (!ADAPT_SUBCOMMANDS.includes(subcommand as AdaptSubcommand)) {
throw new Error(
`Unknown adapt subcommand: ${subcommand}. Supported subcommands: ${ADAPT_SUBCOMMANDS.join(", ")}`,
);
}
if (write && subcommand !== "init") {
throw new Error("--write is only supported with omx adapt <target> init");
}
switch (subcommand as AdaptSubcommand) {
case "probe":
render(
await buildAdaptProbeReportForTarget(cwd, descriptor.target),
json,
stdout,
);
return;
case "status":
render(
await buildAdaptStatusReportForTarget(cwd, descriptor.target),
json,
stdout,
);
return;
case "init":View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Remove --write when using non-init subcommands
- If you intended to write files, use the init subcommand
Example fix
# before omx adapt github probe --write # after omx adapt github probe # or, to write files: omx adapt github init --write
Defensive patterns
Strategy: validation
Validate before calling
if (write && subcommand !== 'init') {
console.error('--write is only valid with init');
process.exit(2);
} Prevention
- Reserve --write for init invocations
- Parameterize scripts so flags are attached to the right subcommand
When it happens
Trigger: Running `omx adapt github probe --write` or combining --write with any non-init subcommand.
Common situations: Copy-pasting a full command including --write, or assuming all subcommands support dry-run/write modes.
Related errors
- Unknown adapt target: ${target}. Supported targets: ${suppor
- Unknown adapt subcommand: ${subcommand}. Supported subcomman
- Unknown adapt argument: ${arg}
- Unknown agents-init option: ${arg}\n${AGENTS_INIT_USAGE}
- agents-init accepts at most one path argument.\n${AGENTS_INI
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/ab73150912268b82.
Report an issue: GitHub.