koala73/worldmonitor · error
Pass only one of --check, --write, --apply
Error message
Pass only one of --check, --write, --apply
What it means
This CLI script (scripts/sentry-convex-probe-filters sync) supports three mutually exclusive modes: --check (report only), --write (rewrite filter files), --apply (apply to live config). If more than one of these flags is passed on the command line, main() cannot determine which mode the user intends, so it throws immediately after argument parsing, before any file inspection.
Solutions
- Re-run with exactly one of --check, --write, or --apply.
- If you want to preview first, run --check alone, then run --write or --apply alone.
- Remove the extra flag from any npm script, alias, or CI wrapper that injects it.
- Read the script's usage text (printed when no flags are given: 'Default with no flags: --check') and omit all flags to use the default check mode.
Example fix
// before node scripts/sync-sentry-convex-probe-filters.mjs --check --write // after node scripts/sync-sentry-convex-probe-filters.mjs --write
Defensive patterns
Strategy: validation
Validate before calling
const flags = ['--check', '--write', '--apply'].filter(f => process.argv.includes(f));
if (flags.length > 1) {
console.error(`Pass only one of --check, --write, --apply (got: ${flags.join(', ')})`);
process.exit(1);
} Prevention
- Pick exactly one mode flag per invocation; default (no flags) is --check.
- Audit npm scripts/aliases for flags they inject before adding your own.
- In CI, define the mode as a single variable interpolated into the command, never concatenated flag lists.
When it happens
Trigger: Running e.g. `node scripts/sync-sentry-convex-probe-filters.mjs --check --write` or `--write --apply` or all three flags together. Any invocation where `[args.check, args.write, args.apply].filter(Boolean).length > 1`.
Common situations: Copy-pasting an example command that had --check and appending --write to 'actually do it'; shell aliases or npm scripts that already inject one of the flags; automation wrappers that add --apply unconditionally.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- --args must be valid JSON
- `call` needs a tool name, e.g. `worldmonitor call…
- cannot resolve origin/main for the deploy-drift comparison…
- ` ` needs < >. Usage: worldmonitor < >
- `get` needs an API path, e.g. `worldmonitor get /api/health`
AI-assisted analysis of koala73/worldmonitor@e586b8b4b8 (2026-09-22).
Data as JSON: /api/errors/727f750abc314b86.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/sync-sentry-convex-probe-filters.mjs:511
* CLI entrypoint: default `--check`, or `--write` / `--apply`.
*
* @param {string[]} [argv]
*/
async function main(argv = process.argv.slice(2)) {
const args = parseCliArgs(argv);
if (args.help) {
console.log(`Usage:
node scripts/sync-sentry-convex-probe-filters.mjs --check
node scripts/sync-sentry-convex-probe-filters.mjs --write
node scripts/sync-sentry-convex-probe-filters.mjs --apply [--dry-run]
Default with no flags: --check`);
return;
}
const modeCount = [args.check, args.write, args.apply].filter(Boolean).length;
if (modeCount > 1) {
throw new Error('Pass only one of --check, --write, --apply');
}
const mode = args.write ? 'write' : args.apply ? 'apply' : 'check';
const patterns = expectedInternalPatternsFromSource();
if (patterns.length === 0) {
throw new Error('No internal* Convex exports found under convex/ — refusing to proceed.');
}
if (mode === 'write') {
runWrite(patterns);
return;
}
if (mode === 'check') {
runCheck(patterns);
return;
}
await runApply(patterns, { dryRun: Boolean(args['dry-run']) });
}View on GitHub (pinned to e586b8b4b8)