{"record":{"id":"c12c6d2748fae82e","repo":"risingwavelabs/risingwave","slug":"invalid-worker-type-ty","errorCode":null,"errorMessage":"invalid worker type: {ty}","messagePattern":"invalid worker type: (.+?)","errorType":"http","errorClass":"DashboardError","httpStatus":400,"severity":"warning","filePath":"src/meta/src/dashboard/mod.rs","lineNumber":154,"sourceCode":"\n    impl IntoResponse for DashboardError {\n        fn into_response(self) -> axum::response::Response {\n            let mut resp = Json(json!({\n                \"error\": self.0.to_report_string(),\n            }))\n            .into_response();\n            *resp.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;\n            resp\n        }\n    }\n\n    pub async fn list_clusters(\n        Path(ty): Path<i32>,\n        Extension(srv): Extension<Service>,\n    ) -> Result<Json<Vec<WorkerNode>>> {\n        let worker_type = match WorkerType::try_from(ty) {\n            Ok(WorkerType::Unspecified) | Err(_) => {\n                return Err(err(anyhow!(\"invalid worker type: {ty}\")));\n            }\n            Ok(worker_type) => worker_type,\n        };\n        let mut result = srv\n            .metadata_manager\n            .list_worker_node(Some(worker_type), None)\n            .await\n            .map_err(err)?;\n        result.sort_unstable_by_key(|n| n.id);\n        Ok(result.into())\n    }\n\n    async fn list_table_catalogs_inner(\n        metadata_manager: &MetadataManager,\n        hummock_manager: &HummockManagerRef,\n        table_type: TableType,\n    ) -> Result<Json<Vec<TableWithStats>>> {\n        let tables = metadata_manager","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/dashboard/mod.rs#L136-L172","documentation":"The dashboard's `list_clusters` HTTP handler converts the path parameter `ty` (an i32) into a `WorkerType` via `TryFrom`. If the conversion fails or yields `Unspecified`, the handler responds with \"invalid worker type: {ty}\" — the requested numeric worker type is not a valid enum value.","triggerScenarios":"GET to the dashboard `/clusters/:ty` endpoint with a path segment that is not one of the defined WorkerType discriminants (e.g. 0, negative numbers, or IDs for types removed in newer versions).","commonSituations":"Hand-typed dashboard URLs or scripts using the wrong enum number; version skew where a client uses a WorkerType value the running meta doesn't define; typos in monitoring configurations referencing worker type codes.","solutions":["Use a valid WorkerType numeric value in the dashboard path (check the `WorkerType` protobuf enum for the discriminants, e.g. Frontend/Compute/Compactor).","Omit/adjust the filter to list all workers if you don't need to filter by type.","Fix automation/scripts that hardcode worker type codes after a protobuf enum change, and align client and server versions.","Validate the `ty` value client-side against the WorkerType enum before calling the endpoint."],"exampleFix":"// before\nGET /api/clusters/0   // Unspecified -> rejected\n// after\nGET /api/clusters/1   // e.g. Frontend","handlingStrategy":"validation","validationCode":"// Client-side: only send valid WorkerType discriminants\nfn is_valid_worker_type(ty: i32) -> bool {\n    matches!(ty, 1..=6) // per WorkerType proto; excludes 0 = Unspecified\n}","typeGuard":null,"tryCatchPattern":"const res = await fetch(`/api/clusters/${ty}`);\nif (res.status === 500) { // dashboard maps anyhow errors to 500\n  throw new Error(`worker type ${ty} invalid; use a valid WorkerType value`);\n}","preventionTips":["Derive dashboard URLs from the WorkerType protobuf enum instead of hardcoding numbers","Never pass 0 (Unspecified) or negative values as the worker type filter","Keep client tooling and server versions aligned when the WorkerType enum changes"],"tags":["dashboard","http","enum","worker"],"backgroundTag":"invalid-enum-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}