{"record":{"id":"14c514ec3771ef73","repo":"paperclipai/paperclip","slug":"extractexecsyncerrormessage-error-string-err","errorCode":null,"errorMessage":"${extractExecSyncErrorMessage(error) ?? String(error)}","messagePattern":"\\$\\{extractExecSyncErrorMessage\\(error\\) \\?\\? String\\(error\\)\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":1025,"sourceCode":"  }\n\n  mkdirSync(path.dirname(targetPath), { recursive: true });\n\n  const spinner = p.spinner();\n  spinner.start(`Creating git worktree for ${branchName}...`);\n  try {\n    execFileSync(\"git\", resolveGitWorktreeAddArgs({\n      branchName,\n      targetPath,\n      branchExists: localBranchExists(repoRoot, branchName),\n    }), {\n      cwd: repoRoot,\n      stdio: [\"ignore\", \"pipe\", \"pipe\"],\n    });\n    spinner.stop(`Created git worktree at ${targetPath}.`);\n  } catch (error) {\n    spinner.stop(pc.red(\"Failed to create git worktree.\"));\n    throw new Error(extractExecSyncErrorMessage(error) ?? String(error));\n  }\n\n  installDependenciesBestEffort(targetPath);\n\n  return {\n    rootPath: targetPath,\n    configPath: path.resolve(targetPath, \".paperclip\", \"config.json\"),\n    label: branchName,\n    branchName,\n    created: true,\n  };\n}\n\nfunction resolveSourceConnectionString(config: PaperclipConfig, envEntries: Record<string, string>, portOverride?: number): string {\n  if (config.database.mode === \"postgres\") {\n    const connectionString = nonEmpty(envEntries.DATABASE_URL) ?? nonEmpty(config.database.connectionString);\n    if (!connectionString) {\n      throw new Error(","sourceCodeStart":1007,"sourceCodeEnd":1043,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L1007-L1043","documentation":"execFileSync('git worktree add ...') failed while creating the git worktree; extractExecSyncErrorMessage pulls the underlying git/stderr text, so the message is git's own failure output (branch conflict, bad path, etc.).","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:1009 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the underlying git error in the message, fix it, and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}