diegosouzapw/OmniRoute · error

Command arguments must be strings, numbers, or booleans

Error message

Command arguments must be strings, numbers, or booleans

What it means

Element-type guard in normalizeArgs: the `args` array contained at least one element that is not a string, number, or boolean (e.g. null, an object, or a nested array). Each argument is stringified for the sandbox command line, so non-scalar values are rejected to avoid unexpected coercions or injection-prone serialization.

Solutions

  1. Flatten args to scalar values only — strings, numbers, booleans
  2. Serialize complex values to JSON strings yourself before passing them
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/skills/builtins.ts:191 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/369b9efccc797967. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/skills/builtins.ts:191

  const requestedNetwork = input.networkEnabled === true;
  return {
    timeout: normalizePositiveInteger(input.timeoutMs, DEFAULT_SANDBOX_TIMEOUT_MS, 60_000),
    networkEnabled: requestedNetwork && SANDBOX_NETWORK_ENABLED,
    readOnly: true,
  };
}

function truncateOutput(value: string) {
  if (value.length <= MAX_SANDBOX_OUTPUT_CHARS) return { value, truncated: false };
  return { value: value.slice(0, MAX_SANDBOX_OUTPUT_CHARS), truncated: true };
}

function normalizeArgs(args: unknown): string[] {
  if (args === undefined) return [];
  if (!Array.isArray(args)) throw new Error("Field args must be an array");
  return args.map((arg) => {
    if (typeof arg !== "string" && typeof arg !== "number" && typeof arg !== "boolean") {
      throw new Error("Command arguments must be strings, numbers, or booleans");
    }
    return String(arg);
  });
}

export const builtinSkills: Record<string, SkillHandler> = {
  file_read: async (input, context) => {
    const { path: inputPath, encoding = "utf8" } = input as {
      path: string;
      encoding?: BufferEncoding;
    };
    if (!inputPath || typeof inputPath !== "string") {
      throw new Error("Missing required field: path");
    }
    if (encoding !== "utf8" && encoding !== "base64") {
      throw new Error("Unsupported encoding. Use utf8 or base64.");
    }

View on GitHub (pinned to a179ffed5b)