{"record":{"id":"444c0ab3dbd6613e","repo":"Dokploy/dokploy","slug":"bad-request-444c0a","errorCode":"BAD_REQUEST","errorMessage":"Error creating this Gitlab provider","messagePattern":"Error creating this Gitlab provider","errorType":"exception","errorClass":"TRPCError","httpStatus":400,"severity":"error","filePath":"apps/dokploy/server/api/routers/gitlab.ts","lineNumber":48,"sourceCode":"\tcreate: withPermission(\"gitProviders\", \"create\")\n\t\t.input(apiCreateGitlab)\n\t\t.mutation(async ({ input, ctx }) => {\n\t\t\ttry {\n\t\t\t\tconst result = await createGitlab(\n\t\t\t\t\tinput,\n\t\t\t\t\tctx.session.activeOrganizationId,\n\t\t\t\t\tctx.session.userId,\n\t\t\t\t);\n\n\t\t\t\tawait audit(ctx, {\n\t\t\t\t\taction: \"create\",\n\t\t\t\t\tresourceType: \"gitProvider\",\n\t\t\t\t\tresourceName: input.name,\n\t\t\t\t});\n\n\t\t\t\treturn result;\n\t\t\t} catch (error) {\n\t\t\t\tthrow new TRPCError({\n\t\t\t\t\tcode: \"BAD_REQUEST\",\n\t\t\t\t\tmessage: \"Error creating this Gitlab provider\",\n\t\t\t\t\tcause: error,\n\t\t\t\t});\n\t\t\t}\n\t\t}),\n\tone: protectedProcedure\n\t\t.input(apiFindOneGitlab)\n\t\t.query(async ({ input, ctx }) => {\n\t\t\tconst gitlab = await findGitlabById(input.gitlabId);\n\t\t\tawait assertGitProviderAccess(ctx.session, gitlab.gitProvider);\n\t\t\treturn gitlab;\n\t\t}),\n\tgitlabProviders: protectedProcedure.query(async ({ ctx }) => {\n\t\tconst accessibleIds = await getAccessibleGitProviderIds(ctx.session);\n\n\t\tlet result = await db.query.gitlab.findMany({\n\t\t\twith: {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/server/api/routers/gitlab.ts#L30-L66","documentation":"Thrown by the Gitlab create procedure when createGitlab fails while inserting the new GitLab provider record. Like the Gitea twin, it is a generic wrapper — the true cause (constraint violation, invalid column data, DB error) is in error.cause.","triggerScenarios":"Creating a GitLab provider whose name collides with an existing entry, or whose fields fail the service-layer/DB insert; transient DB outage during creation.","commonSituations":"Duplicate friendly-name on retry after a double-submit; schema drift after Dokploy upgrade without migrations; missing required column value (e.g. empty url) that Zod allowed as optional.","solutions":["Log/inspect error.cause for the specific DB error","Unique-ify the provider name and re-submit","Run pending migrations (dokploy upgrade path) if the insert complains about missing columns","Guard the form against double submission"],"exampleFix":"// before\nawait api.gitlab.create.mutate({ name: \"gitlab\" }); // name already exists\n// after\nawait api.gitlab.create.mutate({ name: \"gitlab-prod\" });","handlingStrategy":"try-catch","validationCode":"const list = await api.gitlab.list.query();\nif (list.some((p) => p.name === input.name)) throw new Error(\"name taken\");","typeGuard":"const isGitlabCreateInput = (v: unknown): v is { name: string } =>\n  typeof v === \"object\" && v !== null && typeof (v as any).name === \"string\" && (v as any).name.trim() !== \"\";","tryCatchPattern":"try { await api.gitlab.create.mutate(input); } catch (e) { inspect((e as any).shape?.cause); }","preventionTips":["Unique provider names per org","Run migrations after upgrades"],"tags":["gitlab","git-provider","database-insert","trpc"],"backgroundTag":"database-insert-failed","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}