{"record":{"id":"2b2b5328e64d58ef","repo":"bytebase/bytebase","slug":"codenotfound-2b2b53","errorCode":"CodeNotFound","errorMessage":"project not found for id: %v","messagePattern":"project not found for id: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":404,"severity":"error","filePath":"backend/api/v1/issue_service.go","lineNumber":390,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, \"failed to get projectIDs\"))\n\t\t}\n\t\tif projectIDsFilter != nil {\n\t\t\tprojectIDs = *projectIDsFilter\n\t\t}\n\t} else {\n\t\t// Resolve the project first so an unknown parent is a NotFound rather\n\t\t// than an INTERNAL out of CheckPermission's own project lookup. This\n\t\t// matches what the ACL interceptor does for the IAM-authorized RPCs.\n\t\tproject, err := s.store.GetProject(ctx, &store.FindProjectMessage{\n\t\t\tWorkspace:  common.GetWorkspaceIDFromContext(ctx),\n\t\t\tResourceID: &projectID,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, \"failed to get project\"))\n\t\t}\n\t\tif project == nil {\n\t\t\treturn nil, connect.NewError(connect.CodeNotFound, errors.Errorf(\"project not found for id: %v\", projectID))\n\t\t}\n\t\tok, err := s.iamManager.CheckPermission(ctx, permission.IssuesGet, user, common.GetWorkspaceIDFromContext(ctx), projectID)\n\t\tif err != nil {\n\t\t\treturn nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, \"failed to check permission %q\", permission.IssuesGet))\n\t\t}\n\t\tif !ok {\n\t\t\treturn nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf(\"user does not have permission %q in %q\", permission.IssuesGet, req.Msg.Parent))\n\t\t}\n\t\tprojectIDs = append(projectIDs, projectID)\n\t}\n\tissueFind.ProjectIDs = projectIDs\n\tissueFind.ExcludeDraft = true\n\tif err := s.setNextApproverRoles(ctx, issueFind, approver); err != nil {\n\t\treturn nil, connect.NewError(connect.CodeInternal, err)\n\t}\n\n\tissues, err := s.store.ListIssues(ctx, issueFind)\n\tif err != nil {","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/api/v1/issue_service.go#L372-L408","documentation":"SearchIssues returns CodeNotFound when the explicitly requested project ID in the parent does not exist in the store (GetProject returned nil, nil). This is a clean not-found, not an internal failure — the project was deleted or the ID is wrong.","triggerScenarios":"Calling SearchIssues with parent=\"projects/<id>\" where <id> is misspelled, deleted, or belongs to another environment.","commonSituations":"Stale project IDs cached in client tooling; project deleted by an admin; typos in the parent resource name; using a project from a different Bytebase instance.","solutions":["Verify the project ID via the project list API or UI and correct the parent.","Recreate the project if it was deleted.","Re-fetch project IDs instead of caching them.","Confirm you are hitting the right Bytebase instance/environment."],"exampleFix":"// before\nconst parent = 'projects/prj-old-deleted';\n// after: verify the project exists first\nconst projects = await projectServiceClient.listProjects({});\nconst parent = `projects/${projects.find(p => p.id === 'my-project')?.id}`;\nif (!parent.includes('prj-')) throw new Error('project id missing');","handlingStrategy":"validation","validationCode":"const projects = await projectServiceClient.listProjects({});\nconst exists = projects.projects.some(p => `projects/${p.id}` === parent);\nif (!exists) throw new Error(`project ${parent} does not exist`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hardcode project IDs; resolve them from listProjects.","Handle deletions: re-resolve project IDs before recurring jobs.","Validate the parent matches /^projects\\/[A-Za-z0-9-]+$/ client-side.","Confirm the target environment before searching."],"tags":["not-found","project","rest","go"],"backgroundTag":"resource-not-found","analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}