{"record":{"id":"cb20c804e958acfc","repo":"coollabsio/coolify","slug":"early-fraud-warning-subscription-not-found-charg","errorCode":null,"errorMessage":"Early fraud warning: subscription not found. Charge: {$charge}, id: {$id}, pi: {$pi}","messagePattern":"Early fraud warning: subscription not found\\. Charge: (.+?), id: (.+?), pi: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/Jobs/StripeProcessJob.php","lineNumber":58,"sourceCode":"                    $id = data_get($data, 'id');\n                    $charge = data_get($data, 'charge');\n                    if ($charge) {\n                        $stripe->refunds->create(['charge' => $charge]);\n                    }\n                    $pi = data_get($data, 'payment_intent');\n                    $piData = $stripe->paymentIntents->retrieve($pi, []);\n                    $customerId = data_get($piData, 'customer');\n                    $subscription = Subscription::where('stripe_customer_id', $customerId)->first();\n                    if ($subscription) {\n                        $subscriptionId = data_get($subscription, 'stripe_subscription_id');\n                        $stripe->subscriptions->cancel($subscriptionId, []);\n                        $subscription->update([\n                            'stripe_invoice_paid' => false,\n                        ]);\n                        send_internal_notification(\"Early fraud warning created Refunded, subscription canceled. Charge: {$charge}, id: {$id}, pi: {$pi}\");\n                    } else {\n                        send_internal_notification(\"Early fraud warning: subscription not found. Charge: {$charge}, id: {$id}, pi: {$pi}\");\n                        throw new \\RuntimeException(\"Early fraud warning: subscription not found. Charge: {$charge}, id: {$id}, pi: {$pi}\");\n                    }\n                    break;\n                case 'checkout.session.completed':\n                    $clientReferenceId = data_get($data, 'client_reference_id');\n                    if (is_null($clientReferenceId)) {\n                        // send_internal_notification('Checkout session completed without client reference id.');\n                        break;\n                    }\n                    $userId = Str::before($clientReferenceId, ':');\n                    $teamId = Str::after($clientReferenceId, ':');\n                    $subscriptionId = data_get($data, 'subscription');\n                    $customerId = data_get($data, 'customer');\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}, subscriptionid: {$subscriptionId}.\");\n                        throw new \\RuntimeException(\"User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}, subscriptionid: {$subscriptionId}.\");\n                    }","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Jobs/StripeProcessJob.php#L40-L76","documentation":"Error \"Early fraud warning: subscription not found. Charge: {$charge}, id: {$id}, pi: {$pi}\" thrown in coollabsio/coolify.","triggerScenarios":"Thrown at app/Jobs/StripeProcessJob.php:58 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"}