{"record":{"id":"3ce097528a6a9107","repo":"passbolt/passbolt_api","slug":"the-subscription-cannot-be-verified-parse-error","errorCode":null,"errorMessage":"The subscription cannot be verified. Parse error.","messagePattern":"The subscription cannot be verified\\. Parse error\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"plugins/PassboltEe/Subscription/src/Form/SubscriptionKeyAsciiForm.php","lineNumber":141,"sourceCode":"    /**\n     * Parse the subscription.\n     *\n     * @param string|null $keyAscii key in ascii.\n     * @return \\Passbolt\\Subscription\\Model\\Dto\\SubscriptionKeyDto\n     * @throws \\Exception If the subscription format is not valid\n     */\n    public function parse(?string $keyAscii = null): SubscriptionKeyDto\n    {\n        if (empty($keyAscii) && !empty($this->getData('key_ascii'))) {\n            $keyAscii = $this->getData('key_ascii');\n        }\n\n        $armoredSignedSubscription = $this->getArmoredSignedSubscription($keyAscii);\n\n        $subscriptionInfoStr = $this->_verifySignature($armoredSignedSubscription);\n        $subscriptionInfo = json_decode($subscriptionInfoStr, true);\n        if (is_null($subscriptionInfo)) {\n            throw new Exception(__('The subscription cannot be verified. Parse error.'));\n        }\n\n        $subscriptionInfo['data'] = trim($keyAscii);\n\n        return SubscriptionKeyDto::createFromArray($subscriptionInfo);\n    }\n\n    /**\n     * Get the armored subscription.\n     *\n     * @param string $keyAscii key in ascii\n     * @return string The armored signed subscription\n     * @throws \\Exception If the subscription format is not valid\n     */\n    public function getArmoredSignedSubscription(string $keyAscii): string\n    {\n        $armoredSignedSubscription = base64_decode($keyAscii);\n        if (!$armoredSignedSubscription) {","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Subscription/src/Form/SubscriptionKeyAsciiForm.php#L123-L159","documentation":"The subscription key was successfully base64-decoded and its OpenPGP signature verified, but the signed payload is not valid JSON (json_decode returned null). The SubscriptionKeyAsciiForm.parse() method throws this because it cannot extract subscription metadata (customer_id, expires, etc.) from a payload it cannot decode.","triggerScenarios":"Calling parse() or executing the form with a key whose signed payload was corrupted or truncated after base64 decoding — e.g. the key was manually re-typed, copy-pasted partially, or altered so the verified plaintext is no longer well-formed JSON.","commonSituations":"A subscription key pasted into a spreadsheet or email that mangled whitespace/characters; using a key from a different product or an outdated format; shell/heredoc escaping damage when inserting the key via CLI; a key issued for a different passbolt edition.","solutions":["Re-copy the subscription key exactly as delivered by passbolt (it is a single base64 string) and retry.","Verify the key has no stray characters, line breaks inside, or truncation: `echo '<key>' | base64 -d | gpg --list-packets` should show a signature packet with a JSON literal payload.","Request a new subscription key from passbolt support/account if the payload is genuinely corrupt.","Check that the key matches your edition (CE vs EE) and passbolt version; very old key formats may not decode to the expected JSON."],"exampleFix":"// before (corrupted pasted key)\n$this->Subscriptions->createOrUpdate($uac, 'gAAAA...tRU NCOPIED FROM EMAIL WITH LINE BREAKS');\n// after\n$key = trim(preg_replace('/\\s+/', '', $keyFromEmail));\n$this->Subscriptions->createOrUpdate($uac, $key);","handlingStrategy":"try-catch","validationCode":"$decoded = base64_decode($key, true);\nif ($decoded === false || strpos($decoded, 'BEGIN PGP MESSAGE') === false) { /* reject before parse */ }","typeGuard":null,"tryCatchPattern":"try {\n    $dto = $form->parse($key);\n} catch (\\Exception $e) {\n    Log::error('Subscription key payload not decodable: ' . $e->getMessage());\n    // prompt user to re-copy the key verbatim\n}","preventionTips":["Never manually edit or reformat the subscription key text","Copy the key from the original source as one continuous base64 string","Validate locally with `base64 -d` before submitting"],"tags":["openpgp","subscription-key","json-decode-failed","php"],"backgroundTag":"json-decode-failed","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}