{"record":{"id":"861c8785ca042461","repo":"passbolt/passbolt_api","slug":"the-configuration-0-is-not-correctly-set","errorCode":null,"errorMessage":"The configuration {0} is not correctly set.","messagePattern":"The configuration (.+?) is not correctly set\\.","errorType":"http","errorClass":"InternalErrorException","httpStatus":500,"severity":"error","filePath":"plugins/PassboltCe/JwtAuthentication/src/Service/AccessToken/JwtTokenCreateService.php","lineNumber":73,"sourceCode":"        ];\n\n        return JWT::encode($payload, $privateKey, self::JWT_ALG);\n    }\n\n    /**\n     * Create a UNIX time from a time expressed in words.\n     * This should return an integer.\n     *\n     * @param string|null $expirationPeriod Expiration period in words.\n     * @return int Unix time\n     */\n    public function createExpiryDate(?string $expirationPeriod = null): int\n    {\n        $expiryPeriod = $expirationPeriod ?? Configure::read(JwtTokenCreateService::JWT_EXPIRY_CONFIG_KEY);\n        try {\n            return (int)(new DateTime('+' . $expiryPeriod))->toUnixString();\n        } catch (Throwable $e) {\n            throw new InternalErrorException(\n                __('The configuration {0} is not correctly set.', JwtTokenCreateService::JWT_EXPIRY_CONFIG_KEY),\n                500,\n                $e\n            );\n        }\n    }\n}\n","sourceCodeStart":55,"sourceCodeEnd":81,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/JwtAuthentication/src/Service/AccessToken/JwtTokenCreateService.php#L55-L81","documentation":"The JWT access token expiry configuration (passbolt.auth.token.access_token.expiry) could not be parsed into a valid DateTime interval. JwtTokenCreateService::createExpiryDate builds a '+<period>' string from the configured value and feeds it to DateTime(); any unparseable/empty value throws, and the service converts it into an InternalErrorException (HTTP 500). This is a server-side configuration error, not a client error.","triggerScenarios":"Calling createToken (login/JWT issuance) when passbolt.auth.token.access_token.expiry is missing, set to null, an empty string, or a string that DateTime('+...') cannot parse (e.g. '1 fortnight', 'abc', '4 weeks 3 gibberish'). An explicit $expirationPeriod argument that is malformed triggers the same path.","commonSituations":"Upgrading passbolt after the config key was renamed/moved and the old config file lacks the new key; a typo when overriding the key in a custom config or environment variable; a deployment template leaving the value blank.","solutions":["Set a valid interval string for the config key passbolt.auth.token.access_token.expiry (e.g. '1 month'), matching the format accepted by PHP DateTime('+interval').","Check config/passbolt.default.php or the JwtAuthentication plugin config for the default value and ensure your local/env config does not override it with null/empty.","Run `passbolt healthcheck` (or bin/cake passbolt healthcheck) to detect misconfigured JWT settings.","If passing $expirationPeriod explicitly, validate it parses (new DateTime('+' . $value)) before calling createExpiryDate."],"exampleFix":"// before (config/passbolt.php)\n'auth' => ['token' => ['access_token' => ['expiry' => env('JWT_EXPIRY')]]], // env var unset => null\n// after\n'auth' => ['token' => ['access_token' => ['expiry' => env('JWT_EXPIRY', '1 month')]]],","handlingStrategy":"validation","validationCode":"$expiry = Configure::read('passbolt.auth.token.access_token.expiry');\nif (!is_string($expiry) || $expiry === '' || @new DateTime('+' . $expiry) === false) {\n    throw new RuntimeException('passbolt.auth.token.access_token.expiry must be a valid interval string, e.g. \"1 month\"');\n}","typeGuard":"function isValidIntervalString(mixed $v): bool {\n    return is_string($v) && $v !== '' && (function () use ($v) { try { new DateTime('+' . $v); return true; } catch (Throwable) { return false; } })();\n}","tryCatchPattern":"try {\n    $expiry = $service->createExpiryDate();\n} catch (InternalErrorException $e) {\n    $this->log('JWT expiry config invalid: ' . $e->getPrevious()?->getMessage());\n    throw new RuntimeException('Fix passbolt.auth.token.access_token.expiry; see previous exception', 0, $e);\n}","preventionTips":["Pin a default like env('JWT_EXPIRY', '1 month') so the key is never null","Run `bin/cake passbolt healthcheck` in CI/deploy to catch config drift","Keep expiry values in the DateTime-accepted interval format ('5 minutes', '1 month')"],"tags":["configuration","jwt","internal-error"],"backgroundTag":"invalid-config-value","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}