spacedriveapp/spacedrive · error
Unexpected response: ${JSON.stringify(response)}
Error message
Unexpected response: ${JSON.stringify(response)} What it means
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.
Source
Thrown at packages/ts-client/src/client.ts:223
payload: input,
},
};
const response = await this.transport.sendRequest(request);
// Handle different response formats
if ("JsonOk" in response) {
return response.JsonOk;
} else if ("json" in response) {
// Wire protocol uses lowercase "json" for success
return response.json;
} else if ("Error" in response || "error" in response) {
const error = response.Error || response.error;
throw new Error(
`${isQuery ? "Query" : "Action"} failed: ${JSON.stringify(error)}`,
);
} else {
throw new Error(`Unexpected response: ${JSON.stringify(response)}`);
}
}
/**
* Subscribe to events from the daemon
*/
async subscribe(callback?: (event: Event) => void): Promise<() => void> {
const unlisten = await this.transport.subscribe((event) => {
if (callback) {
callback(event);
}
});
return unlisten;
}
/**
* Subscribe to filtered events from the daemonView on GitHub (pinned to 6dfeccf211)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Before acting on a stored conduit id, confirm it still exists.
async fn conduit_exists(svc: &ConduitService, id: i32) -> bool {
svc.get_conduit(id).await.is_ok()
} Try / catch
match svc.get_conduit(id).await {
Ok(c) => Ok(c),
Err(e) if e.to_string() == "Conduit not found" => {
drop_scheduled_task(id); // prune stale references, don't crash the scheduler
Err(e)
}
Err(e) => Err(e),
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No library selected. Use client.switchToLibrary() first.
- No library selected. Use client.switchToLibrary() first.
- Library with ID '${libraryId}' not found
- Library '{}' not found
- No library selected. Use 'sd library switch' to select a lib
AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16).
Data as JSON: /api/errors/23d5d06558bf0846.
Report an issue: GitHub.