yamadashy/repomix · error · RepomixError

Invalid remote repository URL or repository shorthand (owner

Error message

Invalid remote repository URL or repository shorthand (owner/repo)

What it means

This is the catch-all wrapper in parseRemoteValueInternal: if any step of parsing the remote value (URL parsing, shorthand resolution, ref extraction) throws, the original error is replaced with this generic RepomixError. It means the input was neither a recognizable remote URL nor a valid owner/repo shorthand.

Source

Thrown at src/core/git/gitRemoteParse.ts:121

      return {
        repoUrl: repoUrl,
        remoteBranch: parsedFields.ref,
      };
    }

    if (parsedFields.commit) {
      return {
        repoUrl: repoUrl,
        remoteBranch: parsedFields.commit,
      };
    }

    return {
      repoUrl: repoUrl,
      remoteBranch: undefined,
    };
  } catch {
    throw new RepomixError('Invalid remote repository URL or repository shorthand (owner/repo)');
  }
};

// Re-export from lightweight module to preserve public API
export { isExplicitRemoteUrl } from './gitRemoteUrl.js';

export const isValidRemoteValue = (remoteValue: string, refs: string[] = []): boolean => {
  try {
    parseRemoteValue(remoteValue, refs);
    return true;
  } catch {
    return false;
  }
};

/**
 * Parses remote value and extracts GitHub repository information if it's a GitHub repo
 * Returns null if the remote value is not a GitHub repository

View on GitHub (pinned to f465ad9093)

Solutions

  1. Pass a canonical HTTPS URL (https://github.com/owner/repo) or plain owner/repo shorthand.
  2. Run the string through `git ls-remote` or a URL parser yourself to confirm validity.
  3. If this wraps error 72, fix the owner/repo segment characters.
  4. Check shell quoting/escaping of the argument in scripts.

Example fix

// before
repomix --remote myrepo
// after
repomix --remote owner/myrepo
Defensive patterns

Strategy: validation

Validate before calling

const looksLikeRemote = (v: string) =>
  /^https?:\/\/[^\s/]+\/[^\s/]+\/[^\s/]+/.test(v) || /^[\w.-]+\/[\w.-]+$/.test(v);
if (!looksLikeRemote(input)) throw new Error(`Not a remote URL or owner/repo shorthand: ${input}`);

Type guard

const isOwnerRepo = (v: string): v is `${string}/${string}` => /^[\w.-]+\/[\w.-]+$/.test(v);

Try / catch

try {
  await repomixCli.run(['--remote', remoteInput]);
} catch (e) {
  if (e instanceof RepomixError && e.message.includes('Invalid remote repository URL')) {
    console.error(`'${remoteInput}' is not a valid git URL or owner/repo shorthand.`);
  }
}

Prevention

When it happens

Trigger: parseRemoteValue is given a string that fails parsing entirely — e.g. 'not-a-url', 'owner/', 'https://', an SCP-like syntax it cannot normalize, or a URL whose inner parsing throws (including error 72).

Common situations: Typo in the --remote argument; forgetting the owner segment ('myrepo' instead of 'user/myrepo'); pasting a web page URL with extra segments or a blob path; shell quoting issues mangling the URL.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/14d0f231f0bd948a. Report an issue: GitHub.