{"record":{"id":"673050e096fe56bb","repo":"vercel/turborepo","slug":"package-manager-already-in-use","errorCode":"package_manager-already_in_use","errorMessage":"You are already using this package manager","messagePattern":"You are already using this package manager","errorType":"exception","errorClass":"ConvertError","httpStatus":null,"severity":"warning","filePath":"packages/turbo-workspaces/src/convert.ts","lineNumber":41,"sourceCode":"*/\nexport async function convertProject({\n  project,\n  convertTo,\n  logger,\n  options\n}: {\n  project: Project;\n  convertTo: RequestedPackageManagerDetails;\n  logger: Logger;\n  options?: Options;\n}) {\n  logger.header(\n    `Converting project from ${project.packageManager} to ${convertTo.name}.`\n  );\n\n  if (!options?.ignoreUnchangedPackageManager) {\n    if (project.packageManager === convertTo.name) {\n      throw new ConvertError(\"You are already using this package manager\", {\n        type: \"package_manager-already_in_use\"\n      });\n    }\n\n    if (!convertTo.version) {\n      throw new ConvertError(\n        `${convertTo.name} is not installed, or could not be located`,\n        {\n          type: \"package_manager-could_not_be_found\"\n        }\n      );\n    }\n  }\n\n  // this cast is safe since we've just verified that the version exists above\n  const to = convertTo as AvailablePackageManagerDetails;\n\n  // remove old workspace data","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/packages/turbo-workspaces/src/convert.ts#L23-L59","documentation":"The turbo-workspaces conversion entrypoint refuses a no-op: if the project's detected package manager already equals the target (convertTo.name) and options.ignoreUnchangedPackageManager is not set, it throws ConvertError type package_manager-already_in_use. This protects against 'converting' npm to npm, which would at best reinstall and at worst corrupt lockfiles.","triggerScenarios":"Invoking convert with the same source and target manager (e.g. detected npm -> convert to npm), or when detection picked the manager you are converting to because a stray lockfile or packageManager field for it exists in the repo.","commonSituations":"Automated migration scripts that do not compare the current manager before calling convert, repos with a leftover lockfile from the target manager (e.g. a committed bun.lockb while still on npm) making detection report the wrong current manager, or CI reruns of a conversion step.","solutions":["Compare detected manager vs target before converting; skip if equal","If you truly want to force it (e.g. to regenerate configs), pass options.ignoreUnchangedPackageManager = true","If detection was wrong, remove the stray lockfile/packageManager field of the target manager and re-detect","Check project.packageManager comes from devEngines.packageManager/packageManager or the lockfile you expect"],"exampleFix":"// before\nawait convert({ project, convertTo: npmDetails, logger }); // project is already npm -> throws\n\n// after\nif (project.packageManager !== convertTo.name) {\n  await convert({ project, convertTo, logger });\n} else {\n  await convert({ project, convertTo, logger, options: { ignoreUnchangedPackageManager: true } });\n}","handlingStrategy":"validation","validationCode":"// Skip no-op conversions before calling convert\nfunction isConversionNeeded(project: Project, convertToName: string): boolean {\n  return project.packageManager !== convertToName;\n}\n// if (isConversionNeeded(project, target.name)) await convert(...);","typeGuard":null,"tryCatchPattern":"try {\n  await convert({ project, convertTo, logger, options });\n} catch (err) {\n  if (err instanceof ConvertError && err.type === \"package_manager-already_in_use\") {\n    return; // desired end-state already true - treat as success\n  }\n  throw err;\n}","preventionTips":["Compare detected vs target manager before invoking convert","Only set ignoreUnchangedPackageManager when regenerating configs is the explicit goal","Investigate stray lockfiles when detection reports the manager you were converting to"],"tags":["package-manager","convert","turbo-workspaces","validation"],"backgroundTag":"package-manager-already-in-use","analyzedSha":"f9245100cf0d31d96628804ead485f6bf226e55a","analyzedAt":"2026-08-17T10:46:15.696Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}