{"record":{"id":"2b8fbb8e8d75b50e","repo":"multica-ai/multica","slug":"workspace-not-found","errorCode":null,"errorMessage":"workspace not found","messagePattern":"workspace not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/internal/middleware/workspace.go","lineNumber":45,"sourceCode":"// WorkspaceIDFromContext returns the workspace ID injected by the workspace middleware.\nfunc WorkspaceIDFromContext(ctx context.Context) string {\n\tid, _ := ctx.Value(ctxKeyWorkspaceID).(string)\n\treturn id\n}\n\n// SetMemberContext injects workspace ID and member into the context.\n// This is useful for handlers that resolve the workspace from an entity lookup\n// and want to share the member with downstream code.\nfunc SetMemberContext(ctx context.Context, workspaceID string, member db.Member) context.Context {\n\tctx = context.WithValue(ctx, ctxKeyWorkspaceID, workspaceID)\n\tctx = context.WithValue(ctx, ctxKeyMember, member)\n\treturn ctx\n}\n\n// errWorkspaceNotFound is returned when a slug was provided but doesn't match\n// any workspace. This lets the middleware distinguish \"no identifier provided\"\n// (400) from \"identifier provided but invalid\" (404).\nvar errWorkspaceNotFound = errors.New(\"workspace not found\")\n\n// ResolveWorkspaceIDFromRequest returns the workspace UUID for an HTTP\n// request using the same priority order as the workspace middleware. This is\n// the single source of truth for \"which workspace is this request targeting?\",\n// shared by middleware-protected routes (via context fast path) and\n// middleware-less routes (e.g. /api/upload-file) that must resolve the slug\n// themselves.\n//\n// Priority:\n//  1. task-token binding (X-Actor-Source == \"task_token\") — authoritative,\n//     server-set, cannot be re-negotiated by the client (MUL-2600)\n//  2. middleware-injected context (fast path for middleware-protected routes)\n//  3. X-Workspace-Slug header → GetWorkspaceBySlug → UUID (post-refactor frontend)\n//  4. ?workspace_slug query → GetWorkspaceBySlug → UUID\n//  5. X-Workspace-ID header (CLI/daemon compat)\n//  6. ?workspace_id query (CLI/daemon compat)\n//\n// Returns \"\" when no identifier was provided OR a slug was provided but","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/middleware/workspace.go#L27-L63","documentation":"Error \"workspace not found\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/middleware/workspace.go:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the workspace id or slug and that you are a member of that workspace."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}