chenhg5/cc-connect · error

resolve relay workspace: %w

Error message

resolve relay workspace: %w

What it means

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.

Source

Thrown at core/engine.go:15940

	}
	return platformNameOnly{name: name}
}

func (e *Engine) relayContextForSourceSessionKey(fromProject, sourceSessionKey string) (Agent, *SessionManager, string, error) {
	platformName, chatID, err := parseSessionKeyParts(sourceSessionKey)
	if err != nil {
		return nil, nil, "", fmt.Errorf("invalid source session key: %w", err)
	}

	relaySessionKey := relayConversationKey(fromProject, platformName, chatID)
	if !e.multiWorkspace || e.workspaceBindings == nil {
		return e.agent, e.sessions, relaySessionKey, nil
	}

	channelKey := workspaceChannelKey(platformName, chatID)
	workspace, _, err := e.resolveWorkspace(e.platformForName(platformName), chatID)
	if err != nil {
		return nil, nil, "", fmt.Errorf("resolve relay workspace: %w", err)
	}
	if workspace == "" {
		if b, _, usable := e.lookupEffectiveWorkspaceBinding(channelKey); b != nil && !usable {
			return nil, nil, "", fmt.Errorf("workspace binding unavailable for source channel %q", channelKey)
		}
		return nil, nil, "", fmt.Errorf("no workspace binding for source channel %q", channelKey)
	}

	agent, sessions, err := e.getOrCreateWorkspaceAgent(workspace)
	if err != nil {
		return nil, nil, "", fmt.Errorf("get relay workspace agent: %w", err)
	}
	if ws := e.workspacePool.Get(workspace); ws != nil {
		ws.Touch()
	}
	return agent, sessions, relaySessionKey, nil
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the wrapped cause — it identifies whether the platform or the resolution rule failed
  2. Confirm the platform in the source session key is present in config.toml and compiled in (not excluded via build tags)
  3. Review workspace routing rules/binding config for the affected channel
  4. Temporarily disable multi-workspace to confirm this is the failing subsystem
Defensive patterns

Strategy: validation

Validate before calling

// at startup: verify every platform referenced by workspace rules is registered
for _, name := range configuredRelayPlatforms() {
    if e.platformForName(name) == nil {
        slog.Error("relay references unregistered platform", "platform", name)
    }
}

Try / catch

agent, sessions, key, err := e.relayContextForSourceSessionKey(project, srcKey)
if err != nil && strings.HasPrefix(err.Error(), "resolve relay workspace:") {
    slog.Error("workspace resolution failed", "cause", errors.Unwrap(err))
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/1303181067452163. Report an issue: GitHub.