{"record":{"id":"85ff49eaaae2a059","repo":"yamadashy/repomix","slug":"invalid-repository-url-please-provide-a-valid-url","errorCode":null,"errorMessage":"Invalid repository URL. Please provide a valid URL: ${redactUrl(url)}","messagePattern":"Invalid repository URL\\. Please provide a valid URL: (.+?)","errorType":"validation","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/core/git/gitCommand.ts","lineNumber":247,"sourceCode":"export const validateGitUrl = (url: string): void => {\n  // Block dangerous git parameters that could be used for command injection\n  const dangerousParams = ['--upload-pack', '--receive-pack', '--config', '--exec'];\n  if (dangerousParams.some((param) => url.includes(param))) {\n    throw new RepomixError(`Invalid repository URL. URL contains potentially dangerous parameters: ${redactUrl(url)}`);\n  }\n\n  // Check if the URL starts with git@ or https://\n  if (!(url.startsWith('git@') || url.startsWith('https://'))) {\n    throw new RepomixError(`Invalid URL protocol for '${redactUrl(url)}'. URL must start with 'git@' or 'https://'`);\n  }\n\n  try {\n    if (url.startsWith('https://')) {\n      new URL(url);\n    }\n  } catch (error: unknown) {\n    logger.trace('Invalid repository URL:', redactErrorMessage(error));\n    throw new RepomixError(`Invalid repository URL. Please provide a valid URL: ${redactUrl(url)}`);\n  }\n};\n\n/**\n * Validates a Git ref (branch, tag, or commit) before passing it to git commands.\n * A ref starting with '-' could be interpreted as a git option (e.g. --upload-pack),\n * enabling argument injection. Git's own refname rules also forbid leading '-',\n * so rejecting it is safe for all legitimate branches, tags, and SHAs.\n * @throws {RepomixError} If the ref could be interpreted as a command-line option\n */\nexport const validateGitRef = (ref: string): void => {\n  if (ref.startsWith('-')) {\n    throw new RepomixError(`Invalid branch or ref name. Name must not start with '-': ${ref}`);\n  }\n};\n","sourceCodeStart":229,"sourceCodeEnd":263,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/core/git/gitCommand.ts#L229-L263","documentation":"For https:// URLs, validateGitUrl parses the URL with the WHATWG URL constructor; a parse failure means the URL is malformed and it is rejected with this error. The URL is redacted in the message to avoid leaking embedded credentials.","triggerScenarios":"Passing an https:// URL that `new URL()` cannot parse — missing host (https:///path), spaces or illegal characters, malformed port (https://host:abc/), or a badly formed userinfo section.","commonSituations":"Typos like 'https:/github.com/owner/repo' (single slash), unencoded spaces from shell interpolation, credentials pasted with stray '@' or ':' characters, or truncated URLs from environment variables.","solutions":["Validate the URL in a browser or `new URL(url)` in Node to see the exact parse failure.","Fix typos: ensure 'https://' with two slashes and a proper host, e.g. https://github.com/owner/repo.","Percent-encode illegal characters (spaces, non-ASCII) or remove them.","Check the variable/CI secret supplying the URL for truncation or whitespace."],"exampleFix":"// before\nrepomix --remote \"https:/github.com/owner/repo\"\n\n// after\nrepomix --remote \"https://github.com/owner/repo\"","handlingStrategy":"validation","validationCode":"function assertParseableHttpsUrl(url: string): void {\n  if (url.startsWith('https://')) {\n    try { new URL(url); } catch (e) {\n      throw new Error(`Malformed https URL: ${url} (${(e as Error).message})`);\n    }\n  }\n}","typeGuard":"const isParseableHttpsUrl = (url: string): boolean => {\n  if (!url.startsWith('https://')) return false;\n  try { new URL(url); return true; } catch { return false; }\n};","tryCatchPattern":"try {\n  await repomix.pack({ input: { remote: url } });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid repository URL. Please provide a valid URL:')) {\n    console.error('Fix the https URL syntax — check slashes, host, port, and encoding.');\n  } else throw e;\n}","preventionTips":["Run `new URL(url)` (Node) on remote URLs before passing them to repomix.","Watch for classic typos: single slash (https:/), missing host, bad port.","Percent-encode spaces and non-ASCII characters in URLs.","Inspect CI variables/secrets supplying URLs for truncation or whitespace."],"tags":["git","url-validation","remote"],"backgroundTag":"invalid-git-url","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}