{"record":{"id":"0a1bf1f5e7a0d18e","repo":"BloopAI/vibe-kanban","slug":"result-error","errorCode":null,"errorMessage":"result.error","messagePattern":"result\\.error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/web-core/src/shared/actions/index.ts","lineNumber":883,"sourceCode":"      // Resolve vibe-kanban identifier from remote workspace + issue\n      let issueIdentifier: string | undefined;\n      const remoteWs = ctx.remoteWorkspaces.find(\n        (w) => w.local_workspace_id === workspaceId\n      );\n      if (remoteWs?.issue_id && ctx.projectMutations?.getIssue) {\n        const issue = ctx.projectMutations.getIssue(remoteWs.issue_id);\n        issueIdentifier = issue?.simple_id || remoteWs.issue_id;\n      }\n\n      const result = await CreatePRDialog.show({\n        attempt: workspace,\n        repoId,\n        targetBranch: repo?.target_branch,\n        issueIdentifier,\n      });\n\n      if (!result.success && result.error) {\n        throw new Error(result.error);\n      }\n    },\n  },\n\n  GitLinkPR: {\n    id: 'git-link-pr',\n    label: 'Link Pull Request',\n    icon: LinkIcon,\n    requiresTarget: ActionTargetType.GIT,\n    isVisible: (ctx) => ctx.hasWorkspace && ctx.hasGitRepos && !ctx.hasOpenPR,\n    execute: async (ctx, workspaceId, repoId) => {\n      const result = await workspacesApi.attachPr(workspaceId, {\n        repo_id: repoId,\n      });\n\n      if (result.success && result.data.pr_attached && result.data.pr_number) {\n        invalidateWorkspaceQueries(ctx.queryClient, workspaceId);\n        ctx.queryClient.invalidateQueries({","sourceCodeStart":865,"sourceCodeEnd":901,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/actions/index.ts#L865-L901","documentation":"A workspace action invoked a create/move operation (with repoId, targetBranch, issueIdentifier) through an API that returns a result envelope; when the operation fails, the backend's error string is re-thrown as a JS Error so the action's caller (command bar / UI) can display it. The message text is entirely server-defined via result.error.","triggerScenarios":"Calling the action's execute() where the underlying API resolves with { success: false, error: '<message>' } — e.g. invalid target branch, missing repo, or backend validation failure for the given issueIdentifier.","commonSituations":"Target branch renamed or deleted upstream; repo not found for repoId; issue identifier typo'd or issue moved to another tracker; stale workspace state after a remote change.","solutions":["Read the thrown message — it mirrors the backend result.error and names the failing input.","Verify repoId and targetBranch exist and are correct before invoking the action.","Confirm the issueIdentifier is valid and resolvable on the tracker.","Refresh workspace/repo state and retry if the failure stemmed from stale data."],"exampleFix":"// before\nawait runAction('CreatePR', ctx, workspaceId, repoId); // throws raw backend error\n// after\ntry {\n  await runAction('CreatePR', ctx, workspaceId, repoId);\n} catch (e) {\n  showToast({ variant: 'error', message: e.message });\n}","handlingStrategy":"validation","validationCode":"// before invoking the action\nif (!repoId) throw new Error('Select a repository first');\nconst branchOk = await repoBranchExists(repoId, targetBranch);\nif (!branchOk) throw new Error(`Target branch '${targetBranch}' not found`);","typeGuard":"function isFailedResult<T>(r: { success: boolean; error?: string }): r is { success: false; error: string } {\n  return r.success === false && typeof r.error === 'string';\n}","tryCatchPattern":"try {\n  await action.execute(ctx, workspaceId, repoId);\n} catch (e) {\n  notify({ variant: 'error', message: e instanceof Error ? e.message : 'Action failed' });\n}","preventionTips":["Validate repoId, targetBranch, and issueIdentifier against current server state before executing.","Refresh workspace/repo queries before running actions after remote changes.","Display result.error messages directly in the UI so users see the backend cause.","Keep issue identifiers sourced from pickers/search APIs rather than free text."],"tags":["actions","api-result","validation","workspace"],"backgroundTag":"api-result-error","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}