{"record":{"id":"6542a6c5c718dcde","repo":"halo-dev/halo","slug":"the-name-from-the-request-body-does-not-match-the","errorCode":null,"errorMessage":"The name from the request body does not match the plugin configMapName name.","messagePattern":"The name from the request body does not match the plugin configMapName name\\.","errorType":"validation","errorClass":"ServerWebInputException","httpStatus":400,"severity":"warning","filePath":"application/src/main/java/run/halo/app/core/endpoint/console/PluginEndpoint.java","lineNumber":486,"sourceCode":"\n    private Mono<ServerResponse> updatePluginConfig(ServerRequest request) {\n        final var pluginName = request.pathVariable(\"name\");\n        return client.fetch(Plugin.class, pluginName)\n                .doOnNext(plugin -> {\n                    String configMapName = plugin.getSpec().getConfigMapName();\n                    if (!StringUtils.hasText(configMapName)) {\n                        throw new ServerWebInputException(\n                                \"Unable to complete the request because the plugin configMapName is blank\");\n                    }\n                })\n                .flatMap(plugin -> {\n                    final String configMapName = plugin.getSpec().getConfigMapName();\n                    return request.bodyToMono(ConfigMap.class)\n                            .doOnNext(configMapToUpdate -> {\n                                var configMapNameToUpdate =\n                                        configMapToUpdate.getMetadata().getName();\n                                if (!configMapName.equals(configMapNameToUpdate)) {\n                                    throw new ServerWebInputException(\n                                            \"The name from the request body does not match the plugin \"\n                                                    + \"configMapName name.\");\n                                }\n                            })\n                            .flatMap(configMapToUpdate -> client.fetch(ConfigMap.class, configMapName)\n                                    .map(persisted -> {\n                                        configMapToUpdate\n                                                .getMetadata()\n                                                .setVersion(\n                                                        persisted.getMetadata().getVersion());\n                                        return configMapToUpdate;\n                                    })\n                                    .switchIfEmpty(client.create(configMapToUpdate)))\n                            .flatMap(client::update)\n                            .retryWhen(Retry.backoff(5, Duration.ofMillis(300))\n                                    .filter(OptimisticLockingFailureException.class::isInstance));\n                })\n                .flatMap(configMap -> ServerResponse.ok().bodyValue(configMap));","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/halo-dev/halo/blob/d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8/application/src/main/java/run/halo/app/core/endpoint/console/PluginEndpoint.java#L468-L504","documentation":"Inside updatePluginConfig, after the configMapName precondition passes, the handler reads the request body as a ConfigMap and compares configMapToUpdate.getMetadata().getName() against the plugin's configMapName. It throws ServerWebInputException (HTTP 400) if they differ, to prevent a client from writing a different ConfigMap's data through this plugin-scoped endpoint.","triggerScenarios":"Sending a ConfigMap body whose metadata.name is not equal to the target plugin's configMapName — e.g. copying a config body from another plugin, or sending a default/empty metadata.name.","commonSituations":"Client reuses a config payload from plugin A when saving plugin B; frontend bug sending a stale or template metadata.name; manually constructed request with the wrong ConfigMap name.","solutions":["Set the body's metadata.name to the plugin's actual configMapName before submitting.","Fetch the existing ConfigMap and edit in place rather than constructing a new body.","On the client, derive metadata.name from the plugin's spec.configMapName, never hard-code it."],"exampleFix":"// before\nPUT /plugins/foo/config { \"metadata\": { \"name\": \"wrong-name\" }, ... } // 400\n\n// after\nPUT /plugins/foo/config { \"metadata\": { \"name\": \"<plugin.spec.configMapName>\" }, ... }","handlingStrategy":"validation","validationCode":"String expected = plugin.getSpec().getConfigMapName();\nif (!expected.equals(configMapBody.getMetadata().getName())) {\n    return Mono.error(new ServerWebInputException(\n        \"The name from the request body does not match the plugin configMapName name.\"));\n}","typeGuard":"static boolean nameMatches(Plugin p, ConfigMap body) {\n    return p != null && body != null\n        && java.util.Objects.equals(p.getSpec().getConfigMapName(),\n                                    body.getMetadata().getName());\n}","tryCatchPattern":null,"preventionTips":["Derive the body's metadata.name from plugin.spec.configMapName, never hard-code it.","Fetch and edit the existing ConfigMap in place rather than building a fresh body.","Never reuse one plugin's config payload for another plugin."],"tags":["validation","plugin","config","http-400","idempotency","security"],"backgroundTag":null,"analyzedSha":"d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8","analyzedAt":"2026-08-14T00:18:38.915Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}