coollabsio/coolify · error · RuntimeException

Subscription already exists for customer: {$customerId}

Error message

Subscription already exists for customer: {$customerId}

What it means

Error "Subscription already exists for customer: {$customerId}" thrown in coollabsio/coolify.

Source

Thrown at app/Jobs/StripeProcessJob.php:211

                        // send_internal_notification('payment_intent.payment_failed, no subscription found in Coolify for customer: '.$customerId);
                        break;
                    }
                    if ($subscription->stripe_invoice_paid) {
                        // send_internal_notification('payment_intent.payment_failed but invoice is active for customer: '.$customerId);

                        return;
                    }
                    // send_internal_notification('Subscription payment failed for customer: '.$customerId);
                    break;
                case 'customer.subscription.created':
                    $customerId = data_get($data, 'customer');
                    $subscriptionId = data_get($data, 'id');
                    $teamId = data_get($data, 'metadata.team_id');
                    $userId = data_get($data, 'metadata.user_id');
                    if (! $teamId || ! $userId) {
                        $subscription = Subscription::where('stripe_customer_id', $customerId)->first();
                        if ($subscription) {
                            throw new \RuntimeException("Subscription already exists for customer: {$customerId}");
                        }
                        throw new \RuntimeException('No team id or user id found');
                    }
                    $team = Team::find($teamId);
                    $found = $team->members->where('id', $userId)->first();
                    if (! $found->isAdmin()) {
                        // send_internal_notification("User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}.");
                        throw new \RuntimeException("User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}.");
                    }
                    Subscription::updateOrCreate(
                        ['team_id' => $teamId],
                        [
                            'stripe_subscription_id' => $subscriptionId,
                            'stripe_customer_id' => $customerId,
                            'stripe_invoice_paid' => false,
                        ]
                    );
                    break;

View on GitHub (pinned to 70b9acc424)

When it happens

Trigger: Thrown at app/Jobs/StripeProcessJob.php:211 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17). Data as JSON: /api/errors/ce82b234e4dceefa. Report an issue: GitHub.