{"record":{"id":"af3c98b1d23e9298","repo":"alibaba/spring-ai-alibaba","slug":"missing-params-af3c98","errorCode":"MISSING_PARAMS","errorMessage":"workspace","messagePattern":"workspace","errorType":"error_code","errorClass":"BizException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/WorkspaceController.java","lineNumber":61,"sourceCode":"\n\t/** Service for workspace operations */\n\tprivate final WorkspaceService workspaceService;\n\n\tpublic WorkspaceController(WorkspaceService workspaceService) {\n\t\tthis.workspaceService = workspaceService;\n\t}\n\n\t/**\n\t * Creates a new workspace\n\t * @param workspace Workspace information\n\t * @return Result containing the created workspace ID\n\t */\n\t@PostMapping()\n\tpublic Result<String> createWorkspace(@RequestBody Workspace workspace) {\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\n\t\tif (Objects.isNull(workspace)) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"workspace\"));\n\t\t}\n\n\t\tif (StringUtils.isBlank(workspace.getName())) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"name\"));\n\t\t}\n\n\t\tString workspaceId = workspaceService.createWorkspace(workspace);\n\t\treturn Result.success(context.getRequestId(), workspaceId);\n\t}\n\n\t/**\n\t * Updates an existing workspace\n\t * @param workspaceId ID of the workspace to update\n\t * @param workspace Updated workspace information\n\t * @return Result indicating success\n\t */\n\t@PutMapping(\"/{workspaceId}\")\n\tpublic Result<String> updateWorkspace(@PathVariable(\"workspaceId\") String workspaceId,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/WorkspaceController.java#L43-L79","documentation":"createWorkspace requires a deserialized Workspace body; if the @RequestBody is null (empty or unparseable payload) the controller throws MISSING_PARAMS naming 'workspace'. This fails fast before the service layer is invoked.","triggerScenarios":"POST /workspace (or its base mapping) with no body or a body that does not deserialize into Workspace.","commonSituations":"Calling the create endpoint with an empty POST, wrong Content-Type (e.g. text/plain), or a JSON key typo causing a null object in manual clients.","solutions":["Send a JSON body representing the workspace, e.g. {\"name\":\"my-workspace\"}","Set Content-Type: application/json on the request","Verify the Workspace field names match the API model","Check client serialization code for accidental empty-body sends"],"exampleFix":"// before\ncurl -X POST http://host/workspace\n// after\ncurl -X POST http://host/workspace -H 'Content-Type: application/json' -d '{\"name\":\"my-workspace\"}'","handlingStrategy":"validation","validationCode":"function canCreateWorkspace(input) {\n  return typeof input === 'object' && input !== null\n    && typeof input.name === 'string' && input.name.trim().length > 0;\n}\nif (!canCreateWorkspace(payload)) throw new Error('workspace body with name is required');","typeGuard":"function isWorkspace(v) {\n  return typeof v === 'object' && v !== null && typeof v.name === 'string';\n}","tryCatchPattern":"try {\n  await api.post('/workspace', workspace);\n} catch (e) {\n  if (e.response?.data?.code === 'MISSING_PARAMS') {\n    showToast('Workspace payload is required');\n  } else throw e;\n}","preventionTips":["Always serialize a JSON body on POST/PUT calls; never issue bare POSTs","Set Content-Type: application/json globally in the HTTP client","Validate objects with a schema (zod/joi) before sending","Log outgoing request bodies in development to catch empty payloads"],"tags":["validation","rest-api","workspace"],"backgroundTag":"missing-required-argument","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}