{"record":{"id":"e9541d31b0810516","repo":"tinyhumansai/openhuman","slug":"threadid-is-required","errorCode":null,"errorMessage":"threadId is required","messagePattern":"threadId is required","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/api/rest.rs","lineNumber":1080,"sourceCode":"            bearer_jwt,\n            Method::POST,\n            &format!(\"channels/{encoded}/threads\"),\n            Some(body),\n        )\n        .await\n    }\n\n    /// Updates an existing thread (e.g., closing or reopening it).\n    pub async fn update_channel_thread(\n        &self,\n        channel: &str,\n        bearer_jwt: &str,\n        thread_id: &str,\n        action: &str,\n    ) -> Result<Value> {\n        let channel = channel.trim().trim_matches('/');\n        anyhow::ensure!(!channel.is_empty(), \"channel is required\");\n        anyhow::ensure!(!thread_id.trim().is_empty(), \"threadId is required\");\n        anyhow::ensure!(\n            action == \"close\" || action == \"reopen\",\n            \"action must be 'close' or 'reopen'\"\n        );\n        let encoded_channel = urlencoding::encode(channel);\n        let encoded_thread = urlencoding::encode(thread_id.trim());\n        let body = serde_json::json!({ \"action\": action });\n        self.authed_json(\n            bearer_jwt,\n            Method::PATCH,\n            &format!(\"channels/{encoded_channel}/threads/{encoded_thread}\"),\n            Some(body),\n        )\n        .await\n    }\n\n    /// Lists threads in a communication channel, optionally filtering by status.\n    pub async fn list_channel_threads(","sourceCodeStart":1062,"sourceCodeEnd":1098,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/api/rest.rs#L1062-L1098","documentation":"anyhow::ensure! argument guard in update_channel_thread: after trimming, the thread_id parameter is empty. The method POSTs channels/{channel}/threads/{thread_id} with a close/reopen action; an empty thread id would build a malformed backend route (…/threads/) and fail remotely, so the request is rejected client-side before any network call.","triggerScenarios":"Thrown at src/api/rest.rs:1080 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the real thread id obtained from the channel's thread listing/creation response","Trim-check caller inputs before invoking the helper","Debug the caller if an id was expected — the value was empty or whitespace at source"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}