{"record":{"id":"0a3564c6f7bf6352","repo":"BloopAI/vibe-kanban","slug":"action-action-id-requires-a-workspace-target","errorCode":null,"errorMessage":"Action \"${action.id}\" requires a workspace target","messagePattern":"Action \"(.+?)\" requires a workspace target","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/web-core/src/shared/providers/ActionsProvider.tsx","lineNumber":281,"sourceCode":"  ]);\n\n  // Main action executor with centralized target validation and error handling\n  const executeAction = useCallback(\n    async (\n      action: ActionDefinition,\n      workspaceId?: string,\n      repoIdOrProjectId?: string,\n      issueIds?: string[]\n    ): Promise<void> => {\n      try {\n        switch (action.requiresTarget) {\n          case ActionTargetType.NONE:\n            await action.execute(executorContext);\n            break;\n\n          case ActionTargetType.WORKSPACE:\n            if (!workspaceId) {\n              throw new Error(\n                `Action \"${action.id}\" requires a workspace target`\n              );\n            }\n            await action.execute(executorContext, workspaceId);\n            break;\n\n          case ActionTargetType.GIT:\n            if (!workspaceId || !repoIdOrProjectId) {\n              throw new Error(\n                `Action \"${action.id}\" requires both workspace and repository`\n              );\n            }\n            await action.execute(\n              executorContext,\n              workspaceId,\n              repoIdOrProjectId\n            );\n            break;","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/providers/ActionsProvider.tsx#L263-L299","documentation":"ActionsProvider.executeAction dispatches based on `action.requiresTarget`. When the action declares ActionTargetType.WORKSPACE, a workspaceId must be supplied by the caller; if it is missing, the provider throws 'Action \"<id>\" requires a workspace target'. The error is caught and surfaced to the user through a destructive ConfirmDialog.","triggerScenarios":"Invoking executeAction(action) (or a context/menu handler wired to it) for an action whose requiresTarget is WORKSPACE while no workspace is selected/active — workspaceId is undefined because nothing is open or the selection was cleared.","commonSituations":"Triggering a workspace-scoped action from a global command palette or keyboard shortcut with no workspace open; invoking an action from a project-level view where the workspace context is not propagated; stale UI after a workspace was closed.","solutions":["Only render/enable WORKSPACE-target actions when a workspace is active (check the selection context before showing the menu item).","Pass the current workspaceId explicitly when calling executeAction.","If invoking programmatically, pre-check `workspaceId` and no-op or show a 'select a workspace' prompt instead."],"exampleFix":"// before\nexecuteAction(action);\n// after\nif (!currentWorkspaceId) return; // or prompt user to open a workspace\nexecuteAction(action, currentWorkspaceId);","handlingStrategy":"validation","validationCode":"if (action.requiresTarget === ActionTargetType.WORKSPACE && !workspaceId) {\n  return; // or prompt the user to open a workspace first\n}\nexecuteAction(action, workspaceId);","typeGuard":null,"tryCatchPattern":"try {\n  await executeAction(action, workspaceId);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('requires a workspace target')) {\n    promptUserToSelectWorkspace();\n  }\n}","preventionTips":["Only enable/offer WORKSPACE actions when a workspace is active","Clear keyboard shortcuts that can fire workspace actions with no context","Centralize action availability checks in one menu/filter helper"],"tags":["actions","validation","missing-argument","react"],"backgroundTag":"missing-required-argument","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}