{"record":{"id":"1303181067452163","repo":"chenhg5/cc-connect","slug":"resolve-relay-workspace-w","errorCode":null,"errorMessage":"resolve relay workspace: %w","messagePattern":"resolve relay workspace: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":15940,"sourceCode":"\t}\n\treturn platformNameOnly{name: name}\n}\n\nfunc (e *Engine) relayContextForSourceSessionKey(fromProject, sourceSessionKey string) (Agent, *SessionManager, string, error) {\n\tplatformName, chatID, err := parseSessionKeyParts(sourceSessionKey)\n\tif err != nil {\n\t\treturn nil, nil, \"\", fmt.Errorf(\"invalid source session key: %w\", err)\n\t}\n\n\trelaySessionKey := relayConversationKey(fromProject, platformName, chatID)\n\tif !e.multiWorkspace || e.workspaceBindings == nil {\n\t\treturn e.agent, e.sessions, relaySessionKey, nil\n\t}\n\n\tchannelKey := workspaceChannelKey(platformName, chatID)\n\tworkspace, _, err := e.resolveWorkspace(e.platformForName(platformName), chatID)\n\tif err != nil {\n\t\treturn nil, nil, \"\", fmt.Errorf(\"resolve relay workspace: %w\", err)\n\t}\n\tif workspace == \"\" {\n\t\tif b, _, usable := e.lookupEffectiveWorkspaceBinding(channelKey); b != nil && !usable {\n\t\t\treturn nil, nil, \"\", fmt.Errorf(\"workspace binding unavailable for source channel %q\", channelKey)\n\t\t}\n\t\treturn nil, nil, \"\", fmt.Errorf(\"no workspace binding for source channel %q\", channelKey)\n\t}\n\n\tagent, sessions, err := e.getOrCreateWorkspaceAgent(workspace)\n\tif err != nil {\n\t\treturn nil, nil, \"\", fmt.Errorf(\"get relay workspace agent: %w\", err)\n\t}\n\tif ws := e.workspacePool.Get(workspace); ws != nil {\n\t\tws.Touch()\n\t}\n\treturn agent, sessions, relaySessionKey, nil\n}\n","sourceCodeStart":15922,"sourceCodeEnd":15958,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L15922-L15958","documentation":"While resolving which workspace a relayed message belongs to, resolveWorkspace failed; cc-connect wraps the cause as 'resolve relay workspace: %w'. Multi-workspace mode routes messages to per-workspace agent instances, so an unresolvable workspace blocks the relay entirely. The underlying cause (platform lookup, binding evaluation) is preserved.","triggerScenarios":"e.multiWorkspace is enabled and e.resolveWorkspace(e.platformForName(platformName), chatID) returns an error during relay — typically the platform name in the session key has no registered platform, or the workspace resolution rule itself errored.","commonSituations":"Session key references a platform that was excluded at build time (no_* build tag) or removed from config.toml; typo'd platform name in workspace routing rules; workspace bindings referencing a deleted chat.","solutions":["Read the wrapped cause — it identifies whether the platform or the resolution rule failed","Confirm the platform in the source session key is present in config.toml and compiled in (not excluded via build tags)","Review workspace routing rules/binding config for the affected channel","Temporarily disable multi-workspace to confirm this is the failing subsystem"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// at startup: verify every platform referenced by workspace rules is registered\nfor _, name := range configuredRelayPlatforms() {\n    if e.platformForName(name) == nil {\n        slog.Error(\"relay references unregistered platform\", \"platform\", name)\n    }\n}","typeGuard":null,"tryCatchPattern":"agent, sessions, key, err := e.relayContextForSourceSessionKey(project, srcKey)\nif err != nil && strings.HasPrefix(err.Error(), \"resolve relay workspace:\") {\n    slog.Error(\"workspace resolution failed\", \"cause\", errors.Unwrap(err))\n    return err\n}","preventionTips":["Keep multi-workspace routing rules and compiled-in platforms in sync","Run cc-connect doctor at startup to detect unresolvable workspaces","Avoid build-tag exclusions for platforms referenced by routing rules","Log effective workspace bindings at boot for easier diagnosis"],"tags":["workspace","relay","multi-workspace","go"],"backgroundTag":"resource-not-found","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}