{"record":{"id":"f0fc0e268b952aed","repo":"passbolt/passbolt_api","slug":"could-not-save-the-metadata-key-please-try-again-later","errorCode":null,"errorMessage":"Could not save the metadata key, please try again later.","messagePattern":"Could not save the metadata key, please try again later\\.","errorType":"http","errorClass":"InternalErrorException","httpStatus":500,"severity":"critical","filePath":"plugins/PassboltCe/Metadata/src/Service/MetadataKeyCreateService.php","lineNumber":115,"sourceCode":"        try {\n            /** @var \\Passbolt\\Metadata\\Model\\Entity\\MetadataKey $result */\n            $result = $metadataKeysTable->saveOrFail($metadataKey);\n        } catch (PersistenceFailedException $e) {\n            $errors = $e->getEntity()->getErrors();\n\n            throw new CustomValidationException(\n                __('The metadata key could not be saved.'),\n                $errors\n            );\n        } catch (CustomValidationException $e) { // @phpstan-ignore-line\n            $msg = __('The metadata key could not be saved.');\n            $msg .= ' ' . $e->getMessage();\n\n            Log::error('Validation errors: ' . json_encode($e->getErrors()));\n\n            throw new CustomValidationException($msg, $e->getErrors(), $e->getTable(), $e->getCode(), $e);\n        } catch (Exception $e) { // @phpstan-ignore-line\n            throw new InternalErrorException(__('Could not save the metadata key, please try again later.'), null, $e);\n        }\n\n        return $result;\n    }\n}\n","sourceCodeStart":97,"sourceCodeEnd":121,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/Metadata/src/Service/MetadataKeyCreateService.php#L97-L121","documentation":"Catch-all handler in buildAndSaveEntity(): any unexpected Exception during metadata key save is converted to InternalErrorException with this retry-style message. It signals an infrastructure/unexpected failure, not a validation problem.","triggerScenarios":"Any non-PersistenceFailed, non-CustomValidation exception thrown inside the try block of buildAndSaveEntity() — DB connection loss, driver errors, exceptions from event listeners during save.","commonSituations":"Database down or misconfigured DSN; storage full; a plugin's event listener throwing; version-upgrade incompatibilities in persistence layer.","solutions":["Inspect the server log for the original exception chained to this InternalErrorException","Verify database availability and configuration (ddev refresh / migrations status)","Retry the creation after transient issues are resolved","Fix or disable the throwing event listener/plugin identified in the stack trace"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check database availability\ntry {\n    $keysTable->find()->first();\n} catch (Exception $e) {\n    // abort before attempting creation\n}","typeGuard":null,"tryCatchPattern":"try {\n    $service->create($uac, $dto);\n} catch (InternalErrorException $e) {\n    $previous = $e->getPrevious(); // inspect root infrastructure cause\n}","preventionTips":["Monitor DB connectivity and disk space","Always inspect getPrevious() on InternalErrorException","Retry only after confirming the transient issue is resolved"],"tags":["metadata","internal-error","database"],"backgroundTag":"database-query-failed","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"}