{"record":{"id":"7e0087b13c04d55a","repo":"yamadashy/repomix","slug":"in-remote-mode-config-must-be-an-absolute-path","errorCode":null,"errorMessage":"In remote mode, --config must be an absolute path to avoid loading config from the cloned repository.\n  Provided: ${cliOptions.config}\n  Example:  repomix --remote <url> --config /home/user/repomix.config.json","messagePattern":"In remote mode, --config must be an absolute path to avoid loading config from the cloned repository\\.\n  Provided: (.+?)\n  Example:  repomix --remote <url> --config /home/user/repomix\\.config\\.json","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/cli/actions/remoteAction.ts","lineNumber":39,"sourceCode":"export const runRemoteAction = async (\n  repoUrl: string,\n  cliOptions: CliOptions,\n  deps = {\n    isGitInstalled,\n    execGitShallowClone,\n    getRemoteRefs,\n    runDefaultAction,\n    downloadGitHubArchive,\n    isGitHubRepository,\n    parseGitHubRepoInfo,\n    isArchiveDownloadSupported,\n    confirmRemoteConfigTrust,\n  },\n): Promise<DefaultActionRunnerResult> => {\n  // Validate --config path before any expensive operations (download/clone):\n  // only absolute paths are allowed to prevent loading config from the cloned repository\n  if (cliOptions.config && !path.isAbsolute(cliOptions.config)) {\n    throw new RepomixError(\n      `In remote mode, --config must be an absolute path to avoid loading config from the cloned repository.\\n` +\n        `  Provided: ${cliOptions.config}\\n` +\n        `  Example:  repomix --remote <url> --config /home/user/repomix.config.json`,\n    );\n  }\n\n  let tempDirPath = await createTempDirectory();\n  let result: DefaultActionRunnerResult;\n  let downloadMethod: 'archive' | 'git' = 'git';\n\n  try {\n    // Check if this is a GitHub repository and archive download is supported\n    const githubRepoInfo = deps.parseGitHubRepoInfo(repoUrl);\n    const shouldTryArchive = githubRepoInfo && deps.isArchiveDownloadSupported(githubRepoInfo);\n\n    if (shouldTryArchive) {\n      // Try GitHub archive download first\n      const spinner = new Spinner('Downloading repository archive...', cliOptions);","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/cli/actions/remoteAction.ts#L21-L57","documentation":"In remote mode repomix clones the target repository and then would load any config file found relative to that clone, so a relative --config path is dangerous — it could resolve inside the downloaded repo. runRemoteAction therefore requires an absolute --config path and throws this before any download/clone happens (src/cli/actions/remoteAction.ts:39).","triggerScenarios":"`repomix --remote <url> --config ./repomix.config.json` or `--config repomix.config.json` — any truthy cliOptions.config that fails path.isAbsolute() while running with --remote.","commonSituations":"Reusing a local-mode command line (`repomix . -c repomix.config.json`) with --remote appended; scripts running from varying working directories where a relative path happened to work locally; copy-pasted examples lacking the absolute-path requirement.","solutions":["Pass an absolute path: `repomix --remote <url> --config \"$PWD/repomix.config.json\"` or `/home/user/repomix.config.json`.","In scripts, convert the path: `--config \"$(realpath ./repomix.config.json)\"`.","If the config is repo-independent, you may also omit --config and rely on defaults plus flags."],"exampleFix":"# before\nrepomix --remote https://github.com/user/repo --config ./repomix.config.json\n# after\nrepomix --remote https://github.com/user/repo --config \"$PWD/repomix.config.json\"","handlingStrategy":"validation","validationCode":"if (args.includes('--remote')) {\n  const i = args.indexOf('--config');\n  const cfg = i !== -1 ? args[i + 1] : undefined;\n  if (cfg && !path.isAbsolute(cfg)) {\n    throw new Error(`--config must be absolute in remote mode: ${path.resolve(cfg)}`);\n  }\n}","typeGuard":"const isAbsConfig = (v: string | undefined): boolean => v === undefined || path.isAbsolute(v);","tryCatchPattern":"try {\n  await repomixRun(['--remote', url, '--config', cfg]);\n} catch (e) {\n  if (String(e.message).includes('must be an absolute path')) {\n    return repomixRun(['--remote', url, '--config', path.resolve(cfg)]);\n  }\n  throw e;\n}","preventionTips":["In remote mode always pass \"$(realpath ...)\" or \"$PWD/...\" for --config.","Keep remote invocations in a dedicated script that normalizes paths once.","Document that relative --config is local-mode only."],"tags":["cli","remote","path-validation","config","repomix"],"backgroundTag":"relative-path-not-allowed","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}