Yeachan-Heo/oh-my-codex · error · Error
${name} must be non-empty
Error message
${name} must be non-empty What it means
normalizeString throws 'X must be non-empty' when a required string argument is present and typed correctly but trims to an empty string ("" or whitespace-only). Required fields must carry actual content, not blank padding.
Source
Thrown at src/mcp/hermes-bridge.ts:141
function jsonResult<T extends Record<string, unknown>>(data: T): HermesBridgeResult<T> {
return { ok: true, data };
}
function failure<T extends Record<string, unknown> = Record<string, unknown>>(
code: HermesBridgeFailureCode,
error: string,
): HermesBridgeResult<T> {
return { ok: false, code, error };
}
function normalizeString(value: unknown, name: string, options: { required?: boolean } = {}): string | undefined {
if (value == null) {
if (options.required) throw new Error(`${name} is required`);
return undefined;
}
if (typeof value !== "string") throw new Error(`${name} must be a string`);
const trimmed = value.trim();
if (!trimmed && options.required) throw new Error(`${name} must be non-empty`);
return trimmed || undefined;
}
function requireMutation(args: Record<string, unknown>): void {
if (args.allow_mutation !== true) {
throw new Error("mutating Hermes bridge tools require allow_mutation: true");
}
}
function normalizePositiveInteger(value: unknown, fallback: number, max: number): number {
if (value == null) return fallback;
const parsed = typeof value === "number" ? value : Number.parseInt(String(value), 10);
if (!Number.isInteger(parsed) || parsed <= 0) return fallback;
return Math.min(parsed, max);
}
async function readJsonFile<T>(path: string): Promise<T | null> {
try {View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Provide a meaningful non-whitespace value
- Trim and check inputs before sending: if (!v.trim()) fill a default
- Debug which upstream variable produced the blank value
Example fix
// before
{ prompt: " " }
// after
{ prompt: "please continue the task" } Defensive patterns
Strategy: validation
Validate before calling
for (const [k,v] of Object.entries(args)) if (typeof v === 'string' && !v.trim()) delete args[k]; // then required checks catch real omissions
Type guard
function isNonBlank(v: unknown): v is string { return typeof v === 'string' && v.trim().length > 0; } Prevention
- Trim inputs and default early
- Don't pass placeholder empty strings for optional fields
- Log outgoing args when debugging MCP calls
When it happens
Trigger: Passing prompt: "" or cwd: " " to a Hermes bridge tool that marks the field required.
Common situations: Template strings interpolating empty variables, whitespace from copy-paste, or placeholder logic that supplies "" instead of omitting the field.
Related errors
- worktreeName must be a relative safe worktree name
- agent name must not be empty
- ${name} is required
- ${name} must be a string
- mutation_not_allowed
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/eaff85417a6b0c6a.
Report an issue: GitHub.