remotion-dev/remotion · error · Error
ARTIFACT_REGISTRY_ENV is ${process.env.ARTIFACT_REGISTRY_ENV
Error message
ARTIFACT_REGISTRY_ENV is ${process.env.ARTIFACT_REGISTRY_ENV}, but it should be either 'development' or 'production' What it means
Thrown by the @remotion/cloudrun container submission script (submit.mjs) at startup if process.env.ARTIFACT_REGISTRY_ENV is not exactly 'development' or 'production'. This env selects which Google Artifact Registry the Cloud Run image is pushed to, so an unset or mistyped value aborts the build before any push.
Source
Thrown at packages/cloudrun/container/submit.mjs:9
import {execSync} from 'child_process';
import {existsSync, rmSync, writeFileSync} from 'fs';
import {VERSION} from 'remotion/version';
import {build} from './build.mjs';
if (
!['development', 'production'].includes(process.env.ARTIFACT_REGISTRY_ENV)
) {
throw new Error(
`ARTIFACT_REGISTRY_ENV is ${process.env.ARTIFACT_REGISTRY_ENV}, but it should be either 'development' or 'production'`,
);
}
if (existsSync('./ensure-browser.mjs')) {
rmSync('./ensure-browser.mjs', {
force: true,
});
}
build();
const isCached = process.argv.includes('--cached');
if (isCached) {
// eslint-disable-next-line no-console
console.log('Creating cacheed image');
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Export the variable with one of the two exact values: `export ARTIFACT_REGISTRY_ENV=production` (or `development`).
- Add the export to your shell profile or CI environment so it is always set.
- Double-check for trailing whitespace or quotes when reading from a .env file.
Example fix
// before $ node packages/cloudrun/container/submit.mjs ARTIFACT_REGISTRY_ENV is undefined, but it should be either 'development' or 'production' // after $ export ARTIFACT_REGISTRY_ENV=production $ node packages/cloudrun/container/submit.mjs
Defensive patterns
Strategy: validation
Validate before calling
const VALID = new Set(['development', 'production']);
const assertRegistryEnv = (env: string | undefined) => {
if (!env || !VALID.has(env)) {
throw new Error(`ARTIFACT_REGISTRY_ENV must be 'development' or 'production' (got '${env}')`);
}
};
assertRegistryEnv(process.env.ARTIFACT_REGISTRY_ENV); Type guard
const isRegistryEnv = (env: unknown): env is 'development' | 'production' => typeof env === 'string' && ['development', 'production'].includes(env);
Prevention
- Set ARTIFACT_REGISTRY_ENV in your shell profile and CI secret store.
- Validate env values at process start with a strict allowlist.
- Trim whitespace when loading env from a .env file.
When it happens
Trigger: Running the Cloud Run container build/submit script without exporting ARTIFACT_REGISTRY_ENV, or with a typo such as 'prod', 'dev', 'staging', or trailing whitespace.
Common situations: Local maintainer building the Cloud Run image without copying the env from CI; a CI secret misnamed; shell that did not reload .env; copy-paste of a value like 'prod' instead of the full word.
Related errors
- Version mismatch: When calling renderMediaOnCloudRun(), you
- Should not download a browser in Cloud Run
- The tag for Remotion version ${VERSION} was not found in the
- serveURL ERROR. File "${fileName}" not found in bucket "${bu
- Failed to create WebGL shader
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/fcd8e8faef62b155.
Report an issue: GitHub.