{"record":{"id":"e01ab853452714c1","repo":"Dokploy/dokploy","slug":"gitlab-provider-not-found","errorCode":null,"errorMessage":"Gitlab provider not found","messagePattern":"Gitlab provider not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/server/src/utils/providers/gitlab.ts","lineNumber":273,"sourceCode":"\t\t}\n\t}\n\n\treturn allBranches as {\n\t\tid: string;\n\t\tname: string;\n\t\tcommit: {\n\t\t\tid: string;\n\t\t};\n\t}[];\n};\n\nexport const testGitlabConnection = async (\n\tinput: z.infer<typeof apiGitlabTestConnection>,\n) => {\n\tconst { gitlabId, groupName } = input;\n\n\tif (!gitlabId) {\n\t\tthrow new Error(\"Gitlab provider not found\");\n\t}\n\n\tawait refreshGitlabToken(gitlabId);\n\n\tconst gitlabProvider = await findGitlabById(gitlabId);\n\n\tconst repositories = await validateGitlabProvider(gitlabProvider);\n\n\tconst filteredRepos = repositories.filter((repo: any) => {\n\t\tconst { full_path, kind } = repo.namespace;\n\n\t\tif (groupName) {\n\t\t\treturn groupName\n\t\t\t\t.split(\",\")\n\t\t\t\t.some((name: string) =>\n\t\t\t\t\tfull_path.toLowerCase().startsWith(name.trim().toLowerCase()),\n\t\t\t\t);\n\t\t}","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/utils/providers/gitlab.ts#L255-L291","documentation":"testGitlabConnection validates its input and throws when gitlabId is missing/falsy, meaning no GitLab provider was selected or passed by the frontend. It is a precondition failure before any network call happens.","triggerScenarios":"Calling the testConnection tRPC mutation with an empty/undefined gitlabId, e.g. testing a provider that was never created or was deleted and the UI still holds a stale reference.","commonSituations":"User opens the test-connection dialog before saving/creating the provider; the provider record was deleted concurrently; form state lost the id.","solutions":["Create and save the Gitlab provider first, then pass its id to testGitlabConnection","Check the client payload includes gitlabId (inspect network request body)","Guard the UI: disable the Test Connection button until a provider is selected"],"exampleFix":"// before\nif (!gitlabId) {\n  throw new Error(\"Gitlab provider not found\");\n}\n\n// after (client side, avoid the call)\nif (!gitlabId) {\n  toast.error(\"Select or create a GitLab provider first\");\n  return;\n}","handlingStrategy":"validation","validationCode":"if (!gitlabId) {\n  toast.error('Select a GitLab provider first');\n  return;\n}","typeGuard":"const hasProviderId = (id: string | null | undefined): id is string =>\n  typeof id === 'string' && id.length > 0;","tryCatchPattern":null,"preventionTips":["Disable the Test Connection action until a provider is selected","Validate input client-side before calling the mutation"],"tags":["gitlab","validation","precondition"],"backgroundTag":"missing-required-parameter","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}