can1357/oh-my-pi · error · CliUsageError
compress requires at least one file or glob pattern
Error message
compress requires at least one file or glob pattern
What it means
omp compress reduces token usage across one or more files; it accepts file paths or glob patterns as positional args. With no positional arguments there is nothing to compress, so the command throws a CliUsageError immediately after parsing.
Source
Thrown at packages/coding-agent/src/commands/compress.ts:31
out: Flags.string({ char: "o", description: "Write the approved text here instead of stdout (single file)" }),
inPlace: Flags.boolean({ char: "i", description: "Overwrite each source file with its approved text" }),
rounds: Flags.integer({ char: "r", description: "Maximum drafts per file before giving up", default: 3 }),
agents: Flags.integer({ char: "n", description: "Files compressed concurrently", default: 4 }),
model: Flags.string({ char: "m", description: "Model selector" }),
};
static examples = [
"omp compress prompts/tools/read.md",
"omp compress notes.md -o notes.compressed.md",
"omp compress 'src/prompts/**/*.md' -i",
"omp compress a.md b.md c.md -i -n 8",
"omp compress spec.md -r 5 -m opus",
];
async run(): Promise<void> {
const { args, flags } = await this.parse(Compress);
const files = args.files ?? [];
if (files.length === 0) throw new CliUsageError("compress requires at least one file or glob pattern");
if (flags.rounds <= 0) throw new CliUsageError("--rounds must be a positive integer");
if (flags.agents <= 0) throw new CliUsageError("--agents must be a positive integer");
if (flags.inPlace && flags.out) throw new CliUsageError("--in-place and --out are mutually exclusive");
const result = await runCompressCommand({
files,
model: flags.model,
maxRounds: flags.rounds,
concurrency: flags.agents,
output: flags.out,
inPlace: flags.inPlace,
});
await postmortem.quit(result.exitCode);
}
}
View on GitHub (pinned to 9690622007)
Solutions
- Pass at least one file or glob: omp compress spec.md or omp compress 'docs/**/*.md'
- Quote globs so the shell does not pre-expand them incorrectly
- Check that your wrapper script actually forwards "$@" or the file list
Example fix
// before omp compress -r 5 // after omp compress spec.md -r 5
Defensive patterns
Strategy: validation
Validate before calling
const files = (args.files ?? []).filter(Boolean);
if (files.length === 0) {
throw new Error('compress requires at least one file or glob pattern');
} Type guard
function hasFiles(a) { return Array.isArray(a?.files) && a.files.length > 0; } Try / catch
try {
await Compress.run(rawArgs);
} catch (err) {
if (err instanceof CliUsageError && err.message.includes('at least one file')) {
console.error('Usage: omp compress <files...> [--rounds N]');
process.exitCode = 1;
} else throw err;
} Prevention
- Always quote globs: omp compress 'docs/**/*.md'
- Forward positional args in wrappers with "$@"
- Check glob expansion count before invoking
When it happens
Trigger: Running bare 'omp compress' or 'omp compress -r 5 -m opus' with flags but no files; invoking programmatically with args.files undefined or an empty array (the code normalizes undefined to [] and checks length === 0).
Common situations: Shell glob failing to expand (nullglob or no matching files leaves zero args); wrapping script dropping positional args; composing a command where flags were added but the file list was forgotten.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- missing operand
- Usage: omp auth-broker import <file|dir> [--provider=<id>] [
- `omp auth-broker migrate` requires an explicit source. Pass
- Expected --${name} to be a positive integer, got ${value}
- Cache flags require --cache
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/2d6a4a2956902541.
Report an issue: GitHub.