{"record":{"id":"c4cabcbfd22801ac","repo":"remotion-dev/remotion","slug":"unknown-package-manager","errorCode":null,"errorMessage":"unknown package manager","messagePattern":"unknown package manager","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/create-video/src/pkg-managers.ts","lineNumber":128,"sourceCode":"\t}\n\n\tif (manager === 'yarn') {\n\t\treturn `yarn run`;\n\t}\n\n\tif (manager === 'pnpm') {\n\t\treturn `pnpm run`;\n\t}\n\n\tif (manager === 'bun') {\n\t\treturn `bun run`;\n\t}\n\n\tif (manager === 'nub') {\n\t\treturn `nub run`;\n\t}\n\n\tthrow new TypeError('unknown package manager');\n};\n\nexport const getRenderCommand = (manager: PackageManager) => {\n\tif (manager === 'npm') {\n\t\treturn `npx remotion render`;\n\t}\n\n\tif (manager === 'yarn') {\n\t\treturn `yarn remotion render`;\n\t}\n\n\tif (manager === 'pnpm') {\n\t\treturn `pnpm exec remotion render`;\n\t}\n\n\tif (manager === 'bun') {\n\t\treturn `bunx remotion render`;\n\t}","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/create-video/src/pkg-managers.ts#L110-L146","documentation":"create-video's getRunCommand maps a PackageManager to its 'run' command prefix (e.g. 'npm run', 'bun run'). The PackageManager union currently includes an unknown/nonstandard value (the code even special-cases 'nub'), and when the manager is not one of the known package managers it throws a TypeError. This indicates a package-manager identifier outside the supported set reached the function.","triggerScenarios":"Calling getRunCommand with a PackageManager value not handled by the if-chain (e.g. a new manager string like 'yarn' that the chain doesn't cover, or an arbitrary string cast to PackageManager).","commonSituations":"Adding a new package manager to the union type without updating all command builders; user-input or env-derived manager strings cast unsafely to PackageManager; typos in the manager selection code.","solutions":["Add a branch for the missing package manager in getRunCommand","Ensure the value passed comes from the supported PackageManager set and is not arbitrary user input","Fix the source that produced the unexpected manager string (env var, CLI arg, prompt)","Check getPackageManager / the detection logic to see why an unsupported manager was returned"],"exampleFix":"// before\nthrow new TypeError('unknown package manager');\n// after\nif (manager === 'yarn') {\n\treturn `yarn run`;\n}\nthrow new TypeError('unknown package manager');","handlingStrategy":"type-guard","validationCode":"const KNOWN_MANAGERS = ['npm','yarn','pnpm','bun','nub'] as const;\nif (!KNOWN_MANAGERS.includes(manager as never)) throw new Error('Unsupported manager: ' + manager);","typeGuard":"const isPackageManager = (v: string): v is PackageManager =>\n\t['npm','yarn','pnpm','bun','nub'].includes(v);","tryCatchPattern":"try {\n\tcmd = getRunCommand(manager);\n} catch (err) {\n\tif (err instanceof TypeError && err.message === 'unknown package manager') {\n\t\tcmd = getRunCommand('npm'); // safe fallback\n\t} else throw err;\n}","preventionTips":["Update every command builder in pkg-managers.ts when extending PackageManager","Derive manager values only from the supported detection logic, never raw user input","Add an exhaustive-switch (or a test iterating all managers) to catch missing branches"],"tags":["package-manager","cli","scaffolding"],"backgroundTag":"invalid-enum-value","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}