Dokploy/dokploy · error · TRPCError

UNAUTHORIZED

UNAUTHORIZED

Error message

Only the owner can share this provider

What it means

Thrown by git-provider share when the provider row's userId or organizationId does not match the session user / active organization. Sharing a Git provider is restricted to the user who owns it within the same org.

Source

Thrown at apps/dokploy/server/api/routers/git-provider.ts:96

						giteaId: r.gitea.giteaId,
						giteaUrl: r.gitea.giteaUrl,
						clientId: r.gitea.clientId,
						isConfigured: !!(r.gitea.accessToken && r.gitea.refreshToken),
					}
				: null,
		}));
	}),

	toggleShare: protectedProcedure
		.input(apiToggleShareGitProvider)
		.mutation(async ({ input, ctx }) => {
			const provider = await findGitProviderById(input.gitProviderId);

			if (
				provider.userId !== ctx.session.userId ||
				provider.organizationId !== ctx.session.activeOrganizationId
			) {
				throw new TRPCError({
					code: "UNAUTHORIZED",
					message: "Only the owner can share this provider",
				});
			}

			await audit(ctx, {
				action: "update",
				resourceType: "gitProvider",
				resourceId: provider.gitProviderId,
				resourceName: provider.name ?? provider.gitProviderId,
			});

			return await updateGitProvider(input.gitProviderId, {
				sharedWithOrganization: input.sharedWithOrganization,
			});
		}),

	allForPermissions: withPermission("member", "update")

View on GitHub (pinned to 546686ea35)

Solutions

  1. Have the provider's owner (provider.userId) perform the share
  2. Ensure the active organization matches provider.organizationId
  3. Re-check ownership with gitProvider.one before calling share
Defensive patterns

Strategy: validation

Validate before calling

const p = await trpc.gitProvider.one.query({ gitProviderId });
if (p.userId !== session.userId || p.organizationId !== activeOrgId) throw new Error('not provider owner');

Prevention

When it happens

Trigger: Calling gitProvider.share with a gitProviderId owned by a different user, or owned by you but under a different active organization.

Common situations: Teammates trying to share an org-mate's provider; owner attempting to share while the wrong org is active in a multi-org session.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/b9f5ec3794fe2734. Report an issue: GitHub.