{"record":{"id":"380c44e2a3248b38","repo":"iflytek/astron-agent","slug":"parameter-error-responseenum","errorCode":"PARAMETER_ERROR","errorMessage":"ResponseEnum.PARAMETER_ERROR","messagePattern":"ResponseEnum\\.PARAMETER_ERROR","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/agentmemory/impl/AgentMemoryServiceImpl.java","lineNumber":61,"sourceCode":"    private final ChatBotBaseMapper chatBotBaseMapper;\n    private final AgentMemorySecretService secretService;\n    private final AgentMemoryProviderFactory providerFactory;\n\n    @Override\n    public AgentMemoryConfigDto getConfig(String uid, Long spaceId, Integer botId) {\n        validateUser(uid);\n        checkBotPermission(uid, spaceId, botId);\n        return findConfig(uid, spaceId, botId, Mem0MemoryProvider.PROVIDER)\n                .map(this::toDto)\n                .orElseGet(() -> defaultDto(botId));\n    }\n\n    @Override\n    @Transactional(rollbackFor = Exception.class)\n    public AgentMemoryConfigDto saveConfig(String uid, Long spaceId, SaveAgentMemoryConfigRequest request) {\n        validateUser(uid);\n        if (request == null || request.getBotId() == null) {\n            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);\n        }\n        checkBotPermission(uid, spaceId, request.getBotId());\n\n        String provider = normalizeProvider(request.getProvider());\n        Optional<AgentMemoryConfig> existing = findConfig(uid, spaceId, request.getBotId(), provider);\n        LocalDateTime now = LocalDateTime.now();\n\n        String nextApiKeyCiphertext = StringUtils.trimToNull(request.getApiKeyCiphertext());\n        if (nextApiKeyCiphertext == null && existing.isPresent()) {\n            nextApiKeyCiphertext = existing.get().getApiKeyCiphertext();\n        }\n        boolean enabled = Boolean.TRUE.equals(request.getEnabled());\n        if (enabled && StringUtils.isBlank(nextApiKeyCiphertext)) {\n            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);\n        }\n\n        AgentMemoryConfig config = existing.orElseGet(AgentMemoryConfig::new);\n        config.setBotId(request.getBotId());","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/agentmemory/impl/AgentMemoryServiceImpl.java#L43-L79","documentation":"AgentMemoryServiceImpl.saveConfig throws PARAMETER_ERROR when the request body is null or botId is null. It is the first validation after validateUser, before bot permission checks. It means the minimal identifiers needed to save a memory config were not supplied.","triggerScenarios":"POSTing the agent memory config save endpoint with a missing/empty body, or with botId absent (null) in SaveAgentMemoryConfigRequest.","commonSituations":"Frontend form not yet bound to a bot when saving; API called via script/curl with incomplete JSON; DTO field name mismatch so botId never deserializes.","solutions":["Always include a valid botId in the request body.","Add @NotNull on botId in SaveAgentMemoryConfigRequest for a clearer validation error.","Check the client serializes the field with the exact name the DTO expects (botId)."],"exampleFix":"// before\nPOST /agent-memory/config\n{}\n// after\nPOST /agent-memory/config\n{\"botId\": 123, \"provider\": \"openai\", \"apiKeyCiphertext\": \"...\", \"enabled\": true}","handlingStrategy":"validation","validationCode":"if (request == null || request.getBotId() == null) { return Promise.reject(new Error(\"botId is required\")); }","typeGuard":"boolean hasBotId(SaveAgentMemoryConfigRequest r) { return r != null && r.getBotId() != null; }","tryCatchPattern":null,"preventionTips":["Use bean validation (@NotNull) on the request DTO.","Always construct a complete request object before calling save APIs.","Check field-name casing matches the server DTO during serialization."],"tags":["validation","parameter","request-body"],"backgroundTag":"missing-required-argument","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}