{"record":{"id":"23d5d06558bf0846","repo":"spacedriveapp/spacedrive","slug":"unexpected-response-json-stringify-response","errorCode":null,"errorMessage":"Unexpected response: ${JSON.stringify(response)}","messagePattern":"Unexpected response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ts-client/src/client.ts","lineNumber":223,"sourceCode":"\t\t\t\t\t\tpayload: input,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\tconst response = await this.transport.sendRequest(request);\n\n\t\t// Handle different response formats\n\t\tif (\"JsonOk\" in response) {\n\t\t\treturn response.JsonOk;\n\t\t} else if (\"json\" in response) {\n\t\t\t// Wire protocol uses lowercase \"json\" for success\n\t\t\treturn response.json;\n\t\t} else if (\"Error\" in response || \"error\" in response) {\n\t\t\tconst error = response.Error || response.error;\n\t\t\tthrow new Error(\n\t\t\t\t`${isQuery ? \"Query\" : \"Action\"} failed: ${JSON.stringify(error)}`,\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new Error(`Unexpected response: ${JSON.stringify(response)}`);\n\t\t}\n\t}\n\n\t/**\n\t * Subscribe to events from the daemon\n\t */\n\tasync subscribe(callback?: (event: Event) => void): Promise<() => void> {\n\t\tconst unlisten = await this.transport.subscribe((event) => {\n\t\t\tif (callback) {\n\t\t\t\tcallback(event);\n\t\t\t}\n\t\t});\n\n\t\treturn unlisten;\n\t}\n\n\t/**\n\t * Subscribe to filtered events from the daemon","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/packages/ts-client/src/client.ts#L205-L241","documentation":"Returned by ConduitService::get_conduit(id) when sync_conduit::Entity::find_by_id(id) finds no row. Every conduit-scoped operation (sync_now, resolver, delete) starts by loading the conduit through this lookup, so a bad id fails here first.","triggerScenarios":"Calling get_conduit / sync_now / any conduit API with an id that was deleted via delete_conduit, never existed, or came from a different library database.","commonSituations":"UI holding a stale conduit id after the user deleted the conduit in another client; concurrent deletion and sync trigger; ids persisted across database resets.","solutions":["Check the row: SELECT * FROM sync_conduit WHERE id = <id>.","If deleted, refresh the conduit list in the client and use a current id.","Treat 'Conduit not found' from sync_now as a signal to remove the item from any scheduled/UI state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before acting on a stored conduit id, confirm it still exists.\nasync fn conduit_exists(svc: &ConduitService, id: i32) -> bool {\n    svc.get_conduit(id).await.is_ok()\n}","typeGuard":null,"tryCatchPattern":"match svc.get_conduit(id).await {\n    Ok(c) => Ok(c),\n    Err(e) if e.to_string() == \"Conduit not found\" => {\n        drop_scheduled_task(id); // prune stale references, don't crash the scheduler\n        Err(e)\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Prune client-side conduit references when delete_conduit succeeds.","In schedulers, treat not-found as 'remove this schedule entry' rather than a fatal error.","Prefer addressing conduits by uuid (get_conduit_by_uuid) for stable external references."],"tags":["rust","database","file-sync","not-found"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}