Yeachan-Heo/oh-my-codex · error · Error
[native-assets] unable to resolve GitHub repository URL for
Error message
[native-assets] unable to resolve GitHub repository URL for native release downloads
What it means
The native-assets hydration module cannot derive a GitHub releases base URL. It first honors the NATIVE_RELEASE_BASE_URL environment override; otherwise it reads the package.json repository field and converts it to an HTTPS base (repositoryHttpBase). If that field is missing, malformed, or not a recognized GitHub URL, the release download URL cannot be constructed and hydration fails.
Source
Thrown at src/cli/native-assets.ts:96
function repositoryHttpBase(repository: { url?: string } | string | undefined): string | undefined {
const raw = typeof repository === 'string' ? repository : repository?.url;
if (!raw?.trim()) return undefined;
const trimmed = raw.trim().replace(/^git\+/, '').replace(/\.git$/, '');
if (trimmed.startsWith('https://github.com/')) return trimmed;
if (trimmed.startsWith('http://github.com/')) return trimmed.replace(/^http:/, 'https:');
return undefined;
}
export async function resolveNativeReleaseBaseUrl(
packageRoot = getPackageRoot(),
version?: string,
env: NodeJS.ProcessEnv = process.env,
): Promise<string> {
const override = env[NATIVE_RELEASE_BASE_URL_ENV]?.trim();
if (override) return override.replace(/\/$/, '');
const pkg = await readPackageJson(packageRoot);
const repo = repositoryHttpBase(pkg.repository);
if (!repo) throw new Error('[native-assets] unable to resolve GitHub repository URL for native release downloads');
const resolvedVersion = version ?? await getPackageVersion(packageRoot);
return `${repo}/releases/download/v${resolvedVersion}`;
}
export async function resolveNativeManifestUrl(
packageRoot = getPackageRoot(),
version?: string,
env: NodeJS.ProcessEnv = process.env,
): Promise<string> {
const override = env[NATIVE_MANIFEST_URL_ENV]?.trim();
if (override) return override;
const baseUrl = await resolveNativeReleaseBaseUrl(packageRoot, version, env);
return `${baseUrl}/native-release-manifest.json`;
}
export function resolveNativeCacheRoot(env: NodeJS.ProcessEnv = process.env): string {
const override = env[NATIVE_CACHE_DIR_ENV]?.trim();
if (override) return resolve(override);View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Set NATIVE_RELEASE_BASE_URL to your releases base (e.g. https://github.com/acme/omx/releases/download) since env override wins.
- Fix package.json: "repository": {"type":"git","url":"https://github.com/owner/repo.git"}.
- If you mirror assets internally, point the env var at your internal mirror's base URL and pre-hydrate the cache in CI.
Example fix
// before
"repository": "git+ssh://git@internal-git.corp/omx.git"
// after
"repository": { "type": "git", "url": "https://github.com/owner/omx.git" }
// or: export NATIVE_RELEASE_BASE_URL=https://github.com/owner/omx/releases/download Defensive patterns
Strategy: validation
Validate before calling
import { readFileSync } from 'node:fs';
function hasRepositoryUrl(pkgPath = 'package.json'): boolean {
try {
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
const repo = pkg.repository;
const url = typeof repo === 'string' ? repo : repo?.url ?? '';
return /^https?:\/\/github\.com\//.test(url.replace(/^git\+/, '').replace(/\.git$/, ''))
|| Boolean(process.env.NATIVE_RELEASE_BASE_URL);
} catch { return false; }
} Try / catch
try { await hydrateNativeBinary(); } catch (e) { if (/unable to resolve GitHub repository URL/.test(String(e))) { /* set NATIVE_RELEASE_BASE_URL or fix package.json, then retry */ } throw e; } Prevention
- Set NATIVE_RELEASE_BASE_URL in CI
- Keep a valid GitHub repository field in package.json
- Snapshot-test package.json metadata before publishing
When it happens
Trigger: Calling resolveNativeReleaseBaseUrl / hydrateNativeBinary when package.json has no repository field, a non-object repository (e.g. a string git URL it can't parse), a URL pointing at a non-GitHub host, or when repositoryHttpBase returns null for shorthand like 'user/repo' variants it doesn't support.
Common situations: Private forks that stripped repository metadata, workspaces publishing from a dist folder without package.json, tarball installs where package.json was pruned, or companies mirroring releases off-GitHub without setting NATIVE_RELEASE_BASE_URL.
Related errors
- [native-assets] failed to fetch native release manifest (${r
- Unknown adapt target: ${target}
- native_agent_canonical_invalid
- invalid auth slot name: use 1-64 letters, numbers, '.', '_'
- [native-assets] manifest version mismatch: expected ${versio
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/79ccf0c5fbc4f07c.
Report an issue: GitHub.