{"record":{"id":"26ff53e2dd11f6b4","repo":"multica-ai/multica","slug":"dingtalk-this-dingtalk-robot-is-already-connected","errorCode":null,"errorMessage":"dingtalk: this DingTalk robot is already connected to a different Multica workspace","messagePattern":"dingtalk: this DingTalk robot is already connected to a different Multica workspace","errorType":"http","errorClass":"ErrRobotOwnedByAnotherWorkspace","httpStatus":409,"severity":"error","filePath":"server/internal/integrations/dingtalk/install.go","lineNumber":36,"sourceCode":")\n\n// This file is the DingTalk install backend. DingTalk uses the\n// bring-your-own-app (BYO) model: the workspace admin creates their own DingTalk\n// Stream-mode robot, and pastes its AppKey (client id) + AppSecret (client\n// secret) into Multica (the paste path lives in byo_install.go). The\n// InstallService owns the at-rest encryption of the AppSecret — so no caller can\n// write a channel_installation with a plaintext secret — plus the shared\n// persistInstall transaction and the list / get / revoke management surface.\n\nvar (\n\t// ErrInstallationNotFound surfaces \"no row matches in this workspace\".\n\tErrInstallationNotFound = errors.New(\"dingtalk installation not found\")\n\t// ErrRobotOwnedByAnotherWorkspace is returned when the pasted DingTalk robot\n\t// is already connected to a live owner in a DIFFERENT Multica workspace — it\n\t// would collide with the (channel_type, app_id) routing index. A DingTalk\n\t// robot is one bot identity and maps to one installation/default agent;\n\t// group-specific routes may target other agents inside that workspace.\n\tErrRobotOwnedByAnotherWorkspace = errors.New(\"dingtalk: this DingTalk robot is already connected to a different Multica workspace\")\n\t// ErrRobotOwnedBySameWorkspace is returned when the robot is already connected\n\t// to a DIFFERENT (live, non-archived) agent in the SAME workspace, pointing\n\t// the user at the Disconnect they can actually reach (#4810).\n\tErrRobotOwnedBySameWorkspace = errors.New(\"dingtalk: this DingTalk robot is already connected to another agent in this workspace\")\n\t// ErrRobotOwnedByArchivedAgent is returned when the robot's owning agent is\n\t// archived (and so still holds the robot, since archiving is reversible). The\n\t// user recovers by restoring that agent or disconnecting its robot.\n\tErrRobotOwnedByArchivedAgent = errors.New(\"dingtalk: this DingTalk robot is connected to an archived agent in this workspace\")\n)\n\n// installQueries is the slice of generated queries InstallService needs. WithTx\n// returns the same interface bound to a transaction so persistInstall runs its\n// upsert atomically (and so tests can inject a fake without a real DB).\ntype installQueries interface {\n\tWithTx(tx pgx.Tx) installQueries\n\tLockDingTalkInstallationOwner(ctx context.Context, arg db.LockDingTalkInstallationOwnerParams) error\n\tGetDingTalkInstallationOwnerForUpdate(ctx context.Context, arg db.GetDingTalkInstallationOwnerForUpdateParams) (db.GetDingTalkInstallationOwnerForUpdateRow, error)\n\tDeleteDingTalkInstallationForReplacement(ctx context.Context, arg db.DeleteDingTalkInstallationForReplacementParams) (pgtype.UUID, error)","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/integrations/dingtalk/install.go#L18-L54","documentation":"Error \"dingtalk: this DingTalk robot is already connected to a different Multica workspace\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/integrations/dingtalk/install.go:36 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Disconnect the robot from the other workspace first, or use a different DingTalk robot."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}