diegosouzapw/OmniRoute · error · Error

GROK_HOME must be an absolute path without traversal

Error message

GROK_HOME must be an absolute path without traversal

What it means

Error "GROK_HOME must be an absolute path without traversal" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/shared/services/grokBuildConfig.ts:40

  subagentModels: Record<GrokSubagentType, GrokModelConfig | null>;
  subagentMappings: Record<GrokSubagentType, string | null>;
}

export interface GrokBuildApplyOptions {
  baseUrl: string;
  apiKey?: string | null;
  model: string;
  contextWindow?: number;
  subagentModels?: Partial<Record<GrokSubagentType, { model: string; contextWindow?: number }>>;
}

/** Resolve config.toml from GROK_HOME or the CLI config home. */
export function resolveGrokBuildConfigPath(env: NodeJS.ProcessEnv, configHome: string): string {
  const grokHome = env.GROK_HOME?.trim();
  if (!grokHome) return path.join(configHome, ".grok", "config.toml");
  const hasTraversal = grokHome.split(/[\\/]+/).includes("..");
  if (!path.isAbsolute(grokHome) || hasTraversal) {
    throw new Error("GROK_HOME must be an absolute path without traversal");
  }
  if (/[$`;&|<>\r\n\0]/.test(grokHome)) {
    throw new Error("GROK_HOME contains invalid characters");
  }
  return path.join(path.normalize(grokHome), "config.toml");
}

const UNSET_SENTINEL = "__omniroute_unset__";
const MANAGED_MARKER = '# omniroute-managed = "true"';
const LEGACY_DESCRIPTION = "Routed via OmniRoute gateway";
const MODELS_SECTION = "models";
const SUBAGENT_MODELS_SECTION = "subagents.models";

const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const tomlString = (value: string): string => JSON.stringify(String(value));
const modelSlot = (type: GrokSubagentType): string => `${GROK_MAIN_MODEL_SLOT}-${type}`;

const sectionRegExp = (section: string): RegExp =>

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/shared/services/grokBuildConfig.ts:40 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/84e897f5c2abf177. Report an issue: GitHub.