{"record":{"id":"93b8f818f9cc8ccb","repo":"windmill-labs/windmill","slug":"could-not-resolve-parent-workspace-make-sure-you","errorCode":null,"errorMessage":"Could not resolve parent workspace. Make sure you are in a git repo with 'workspaces' configured in wmill.yaml, or create a local workspace profile for the fork.","messagePattern":"Could not resolve parent workspace\\. Make sure you are in a git repo with 'workspaces' configured in wmill\\.yaml, or create a local workspace profile for the fork\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/workspace/fork.ts","lineNumber":569,"sourceCode":"  const orgWorkspaces = await allWorkspaces(opts.configDir);\n  const idxOf = orgWorkspaces.findIndex((x) => x.name === name);\n\n  if (idxOf !== -1) {\n    const workspace = orgWorkspaces[idxOf];\n    if (!workspace.workspaceId.startsWith(WM_FORK_PREFIX)) {\n      throw new Error(\n        `You can only delete forked workspaces where the workspace id starts with \\`${WM_FORK_PREFIX}.\\` Failed while attempting to delete \\`${workspace.workspaceId}\\``,\n      );\n    }\n    forkWorkspaceId = workspace.workspaceId;\n    token = workspace.token;\n    remote = workspace.remote;\n    hasLocalProfile = true;\n  } else {\n    // Fallback: resolve parent workspace from branch config and construct fork ID\n    const parentWorkspace = await tryResolveBranchWorkspace(opts);\n    if (!parentWorkspace) {\n      throw new Error(\n        \"Could not resolve parent workspace. Make sure you are in a git repo with 'workspaces' configured in wmill.yaml, or create a local workspace profile for the fork.\",\n      );\n    }\n    forkWorkspaceId = name.startsWith(`${WM_FORK_PREFIX}-`) ? name : `${WM_FORK_PREFIX}-${name}`;\n    token = parentWorkspace.token;\n    remote = parentWorkspace.remote;\n  }\n\n  if (!opts.yes) {\n    const { Select } = await import(\"@cliffy/prompt/select\");\n    const choice = await Select.prompt({\n      message: `Are you sure you want to delete the forked workspace \\`${forkWorkspaceId}\\`?`,\n      options: [\n        { name: \"Yes\", value: \"confirm\" },\n        { name: \"No\", value: \"cancel\" },\n      ],\n    });\n","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/workspace/fork.ts#L551-L587","documentation":"When deleting a fork that has no local workspace profile, `deleteWorkspaceFork` falls back to resolving the parent workspace from the branch config via `tryResolveBranchWorkspace`. If that fails (no git repo or no `workspaces` mapping in wmill.yaml), it cannot construct the fork's credentials/id and throws.","triggerScenarios":"`wmill workspace fork delete` on a workspace without a local profile while `tryResolveBranchWorkspace` returns null — outside a git repo, or wmill.yaml lacks the `workspaces` section.","commonSituations":"Deleting a fork after the wmill.yaml workspaces block was removed; running the CLI in a subdirectory/copy that is not a git repo; collaborator who never added the local workspace profile.","solutions":["Create a local workspace profile for the fork (`wmill workspace add`)","Run from the git repo root with `workspaces` configured in wmill.yaml","Pass the fork by its local profile name so the fallback is not needed"],"exampleFix":"# before\n$ wmill workspace fork delete my-fork  # no profile, no git config\n// after\nwmill workspace add my-fork --remote https://... --token ... && wmill workspace fork delete my-fork","handlingStrategy":"fallback","validationCode":"const parent = await tryResolveBranchWorkspace(opts);\nif (!parent && !hasLocalProfile(name)) {\n  console.error('Create a local profile (wmill workspace add) or configure workspaces in wmill.yaml');\n  process.exit(1);\n}","typeGuard":"function canResolveParent(opts: Opts): Promise<boolean> {\n  return tryResolveBranchWorkspace(opts).then(p => p !== null);\n}","tryCatchPattern":"try {\n  await deleteWorkspaceFork(name, opts);\n} catch (e) {\n  if (e.message.includes('Could not resolve parent workspace')) {\n    log.error('Run from the git repo root or add a local workspace profile.');\n  } else throw e;\n}","preventionTips":["Create a local workspace profile for forks you intend to manage","Run CLI commands from the repo root","Keep the workspaces section of wmill.yaml intact"],"tags":["cli","configuration","git","workspace-fork"],"backgroundTag":"unresolved-parent-workspace","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}