zed icon indicating copy to clipboard operation
zed copied to clipboard

Error: RPC request DeleteChannel failed ... table "rooms" violates foreign key constraint

Open xpe opened this issue 1 year ago • 2 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

I see this: Error: RPC request DeleteChannel failed: error returned from database: update or delete on table "rooms" violates foreign key constraint "room_participants_room_id_fkey" on table "room_participants"

image

when I attempt to delete my #zed channel which is different than my ))) zed channel.

image

Sorry if my screenshots are confusing -- I renamed the channel from zed to zed2 along the way.

Related questions:

  • How do I reset my Zed environment / backing database?
  • I'm not sure what I have two channels with the same name ('zed'). Probably because I tried to add zed myself before the official one connected?

Environment

Zed: v0.120.4 (Zed Preview) OS: macOS 14.2.1 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

2024-01-30T21:20:46 [INFO] ========== starting zed ==========
2024-01-30T21:20:46 [INFO] Opening main db
2024-01-30T21:20:46 [INFO] set environment variables from shell:/bin/zsh, path:/Users/xpe/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/xpe/.cargo/bin:/Users/xpe/bin
2024-01-30T21:20:46 [ERROR] crates/zed/src/zed.rs:535: EOF while parsing a value at line 1 column 0
2024-01-30T21:20:46 [INFO] Opening main db
2024-01-30T21:20:46 [INFO] set status on client 0: Authenticating
2024-01-30T21:20:46 [INFO] set status on client 83582: Connecting
2024-01-30T21:20:46 [INFO] Node runtime install_if_needed
2024-01-30T21:20:46 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-01-30T21:20:47 [INFO] add connection to peer
2024-01-30T21:20:47 [INFO] waiting for server hello
2024-01-30T21:20:47 [INFO] got server hello
2024-01-30T21:20:47 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 322, id: 28408 })
2024-01-30T21:20:47 [INFO] set status on client 83582: Connected { peer_id: PeerId { owner_id: 322, id: 28408 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-01-30T21:20:47 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-01-30T21:20:47.338Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-01-30T21:20:47.338Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-01-30T21:20:47 [INFO] 0 unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "e66f8df7-660a-4360-b55f-6c688434f5c8",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-01-30T21:20:47 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-01-30T21:20:47.345Z] Telemetry initialized",
  "metadataStr": "[DEBUG] [agent] [2024-01-30T21:20:47.345Z]",
  "extra": [
    "Telemetry initialized"
  ]
}
2024-01-30T21:21:57 [INFO] ========== starting zed ==========
2024-01-30T21:21:57 [INFO] Opening main db
2024-01-30T21:21:57 [INFO] set environment variables from shell:/bin/zsh, path:/Users/xpe/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/xpe/.cargo/bin:/Users/xpe/bin
2024-01-30T21:21:57 [ERROR] crates/zed/src/zed.rs:535: EOF while parsing a value at line 1 column 0
2024-01-30T21:21:57 [INFO] set status on client 0: Authenticating
2024-01-30T21:21:57 [INFO] set status on client 83582: Connecting
2024-01-30T21:21:58 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-01-30T21:21:58 [INFO] Node runtime install_if_needed
2024-01-30T21:21:58 [INFO] add connection to peer
2024-01-30T21:21:58 [INFO] waiting for server hello
2024-01-30T21:21:58 [INFO] got server hello
2024-01-30T21:21:58 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 322, id: 28517 })
2024-01-30T21:21:58 [INFO] set status on client 83582: Connected { peer_id: PeerId { owner_id: 322, id: 28517 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-01-30T21:21:58 [INFO] Opening main db
2024-01-30T21:21:58 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-01-30T21:21:58.514Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-01-30T21:21:58.514Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-01-30T21:21:58 [INFO] 0 unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "226f06e6-79f7-4166-91eb-6d7a3ab03605",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-01-30T21:21:58 [ERROR] crates/ai/src/providers/open_ai/embedding.rs:170: NotPresent
2024-01-30T21:21:58 [ERROR] crates/semantic_index/src/semantic_index.rs:86: user is not authenticated
2024-01-30T21:21:58 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-01-30T21:21:58.579Z] Telemetry initialized",
  "metadataStr": "[DEBUG] [agent] [2024-01-30T21:21:58.579Z]",
  "extra": [
    "Telemetry initialized"
  ]
}
2024-01-30T21:22:09 [INFO] leaving room
2024-01-30T21:22:09 [ERROR] crates/call/src/room.rs:1536: room was dropped
2024-01-30T21:22:24 [INFO] published audio track TR_AMn7T47Qdbtrxt
2024-01-30T21:22:38 [ERROR] TODO RPC request DeleteChannel failed: Execution Error: error returned from database: update or delete on table "rooms" violates foreign key constraint "room_participants_room_id_fkey" on table "room_participants"
2024-01-30T21:22:40 [INFO] leaving room
2024-01-30T21:22:40 [ERROR] timed out waiting on app_will_quit
2024-01-30T21:22:44 [INFO] ========== starting zed ==========
2024-01-30T21:22:44 [INFO] Opening main db
2024-01-30T21:22:44 [INFO] set environment variables from shell:/bin/zsh, path:/Users/xpe/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/xpe/.cargo/bin:/Users/xpe/bin
2024-01-30T21:22:44 [ERROR] crates/zed/src/zed.rs:535: EOF while parsing a value at line 1 column 0
2024-01-30T21:22:44 [INFO] Opening main db
2024-01-30T21:22:44 [INFO] build git repository ".git"
2024-01-30T21:22:44 [INFO] Opening main db
2024-01-30T21:22:44 [INFO] set status on client 0: Authenticating
2024-01-30T21:22:44 [INFO] set status on client 83582: Connecting
2024-01-30T21:22:44 [ERROR] crates/workspace/src/persistence/model.rs:257: ProjectPath { worktree_id: WorktreeId(4294967306), path: "daverge_server/src/server/routes/admin/users/handlers.rs" } opening failure: No such file or directory (os error 2)
2024-01-30T21:22:44 [ERROR] crates/workspace/src/persistence/model.rs:257: ProjectPath { worktree_id: WorktreeId(4294967306), path: "daverge_server/src/server/routes/admin/users/mod.rs" } opening failure: No such file or directory (os error 2)
2024-01-30T21:22:44 [ERROR] crates/ai/src/providers/open_ai/completion.rs:232: NotPresent
2024-01-30T21:22:44 [INFO] starting language server "rust-analyzer", path: "/Users/xpe/daverge/api", id: 1
2024-01-30T21:22:44 [INFO] Node runtime install_if_needed
2024-01-30T21:22:44 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-01-30T21:22:44 [INFO] add connection to peer
2024-01-30T21:22:44 [INFO] waiting for server hello
2024-01-30T21:22:45 [INFO] got server hello
2024-01-30T21:22:45 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 322, id: 28584 })
2024-01-30T21:22:45 [INFO] set status on client 83582: Connected { peer_id: PeerId { owner_id: 322, id: 28584 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-01-30T21:22:45 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-01-30T21:22:45.225Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-01-30T21:22:45.225Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-01-30T21:22:45 [INFO] 0 unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "bdb4a6ee-fedf-4033-90bc-673897e3ab72",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-01-30T21:22:45 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-01-30T21:22:45.231Z] Telemetry initialized",
  "metadataStr": "[DEBUG] [agent] [2024-01-30T21:22:45.231Z]",
  "extra": [
    "Telemetry initialized"
  ]
}
2024-01-30T21:22:46 [INFO] 1 unhandled notification experimental/serverStatus:
{
  "health": "ok",
  "quiescent": false,
  "message": null
}
2024-01-30T21:22:49 [INFO] 1 unhandled notification experimental/serverStatus:
{
  "health": "ok",
  "quiescent": true,
  "message": null
}
2024-01-30T21:22:51 [INFO] published audio track TR_AMgZvTp3kQKimG
2024-01-30T21:23:05 [ERROR] TODO RPC request DeleteChannel failed: Execution Error: error returned from database: update or delete on table "rooms" violates foreign key constraint "room_participants_room_id_fkey" on table "room_participants"
2024-01-30T21:23:21 [INFO] leaving room
2024-01-30T21:24:17 [WARN] incoming response: unknown request connection_id=0/0 message_id=94 responding_to=72
2024-01-30T21:24:18 [WARN] incoming response: unknown request connection_id=0/0 message_id=95 responding_to=74
2024-01-30T21:27:28 [INFO] leaving room
2024-01-30T21:28:18 [INFO] published audio track TR_AMVJR7SbFmnpoe
2024-01-30T21:28:24 [ERROR] TODO RPC request DeleteChannel failed: Execution Error: error returned from database: update or delete on table "rooms" violates foreign key constraint "room_participants_room_id_fkey" on table "room_participants"
2024-01-30T21:28:32 [INFO] leaving room
2024-01-30T21:28:32 [ERROR] crates/lsp/src/lsp.rs:615: oneshot canceled
2024-01-30T21:28:32 [ERROR] timed out waiting on app_will_quit
2024-01-30T23:40:05 [WARN] incoming response: unknown request connection_id=0/0 message_id=189 responding_to=97
2024-01-30T23:42:55 [INFO] published audio track TR_AM5YCq4xgTLbrS
2024-01-30T23:43:08 [ERROR] TODO RPC request DeleteChannel failed: Execution Error: error returned from database: update or delete on table "rooms" violates foreign key constraint "room_participants_room_id_fkey" on table "room_participants"

xpe avatar Jan 30 '24 23:01 xpe

Thanks for the report @xpe. Are you trying to delete the room you are in? If so, what happens when you leave the room and try to delete it? If that is the case, we should either make it so you can delete rooms you are in, or have a better error message - that one is not user friendly.

JosephTLyons avatar Feb 02 '24 02:02 JosephTLyons

hi! I managed to replicate the bug, as far as I can tell, this error just happens if you are in the room you are trying to delete, so all that should be done is a more user friendly error message like "you cannot delete a room you are in, please exit the room first."

Kokonico avatar Feb 25 '24 03:02 Kokonico

I get the same error when I try to leave the zed channel. I am not in a room. RPC request RemoveChannelMember failed: invalid notification kind "ChannelInvitation". Please try again.

georgeo-zh avatar Mar 21 '24 22:03 georgeo-zh

@georgeo-zh this is a different error so you probably should create a separate issue for that, filling up details on how to procude.

This issue (#7117) could be renamed to "give better error message when trying to delete a channel with people in it" or "allow to delete a channel if there are people in".

marcospb19-cw avatar Mar 31 '24 20:03 marcospb19-cw