{"record":{"id":"0ebea4acc78bb5c4","repo":"coollabsio/coolify","slug":"user-userid-is-not-an-admin-or-owner-of-team-0ebea4","errorCode":null,"errorMessage":"User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}.","messagePattern":"User (.+?) is not an admin or owner of team (.+?), customerid: (.+?)\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/Jobs/StripeProcessJob.php","lineNumber":219,"sourceCode":"                    // send_internal_notification('Subscription payment failed for customer: '.$customerId);\n                    break;\n                case 'customer.subscription.created':\n                    $customerId = data_get($data, 'customer');\n                    $subscriptionId = data_get($data, 'id');\n                    $teamId = data_get($data, 'metadata.team_id');\n                    $userId = data_get($data, 'metadata.user_id');\n                    if (! $teamId || ! $userId) {\n                        $subscription = Subscription::where('stripe_customer_id', $customerId)->first();\n                        if ($subscription) {\n                            throw new \\RuntimeException(\"Subscription already exists for customer: {$customerId}\");\n                        }\n                        throw new \\RuntimeException('No team id or user id found');\n                    }\n                    $team = Team::find($teamId);\n                    $found = $team->members->where('id', $userId)->first();\n                    if (! $found->isAdmin()) {\n                        // send_internal_notification(\"User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}.\");\n                        throw new \\RuntimeException(\"User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}.\");\n                    }\n                    Subscription::updateOrCreate(\n                        ['team_id' => $teamId],\n                        [\n                            'stripe_subscription_id' => $subscriptionId,\n                            'stripe_customer_id' => $customerId,\n                            'stripe_invoice_paid' => false,\n                        ]\n                    );\n                    break;\n                case 'customer.subscription.updated':\n                    $teamId = data_get($data, 'metadata.team_id');\n                    $userId = data_get($data, 'metadata.user_id');\n                    $customerId = data_get($data, 'customer');\n                    $status = data_get($data, 'status');\n                    $subscriptionId = data_get($data, 'items.data.0.subscription') ?? data_get($data, 'id');\n                    $planId = data_get($data, 'items.data.0.plan.id') ?? data_get($data, 'plan.id');\n                    if (Str::contains($excludedPlans, $planId)) {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Jobs/StripeProcessJob.php#L201-L237","documentation":"Error \"User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}.\" thrown in coollabsio/coolify.","triggerScenarios":"Thrown at app/Jobs/StripeProcessJob.php:219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}