{"record":{"id":"51246694b27ce9d5","repo":"chenhg5/cc-connect","slug":"e-i18n-t-msgdirnotsupported","errorCode":null,"errorMessage":"e.i18n.T(MsgDirNotSupported)","messagePattern":"e\\.i18n\\.T\\(MsgDirNotSupported\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/engine.go","lineNumber":13340,"sourceCode":"\t}\n\n\treturn cb.Build(), nil\n}\n\n// dirCardTruncPath shortens absolute paths for card list rows.\nfunc dirCardTruncPath(absPath string) string {\n\tr := []rune(absPath)\n\tif len(r) <= 56 {\n\t\treturn absPath\n\t}\n\treturn string(r[:53]) + \"…\"\n}\n\nfunc (e *Engine) renderDirCard(sessionKey string, page int) (*Card, error) {\n\tagent, _ := e.sessionContextForKey(sessionKey)\n\tswitcher, ok := agent.(WorkDirSwitcher)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"%s\", e.i18n.T(MsgDirNotSupported))\n\t}\n\tcurrentDir := switcher.GetWorkDir()\n\tvar history []string\n\tif e.dirHistory != nil {\n\t\thistory = e.dirHistory.List(e.name)\n\t}\n\ttotal := len(history)\n\ttotalPages := 1\n\tif total > 0 {\n\t\ttotalPages = (total + dirCardPageSize - 1) / dirCardPageSize\n\t}\n\tif page < 1 {\n\t\tpage = 1\n\t}\n\tif page > totalPages {\n\t\tpage = totalPages\n\t}\n\tstart := (page - 1) * dirCardPageSize","sourceCodeStart":13322,"sourceCodeEnd":13358,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L13322-L13358","documentation":"Returned when the /dir (working-directory) command is used with an agent that does not implement the optional WorkDirSwitcher capability interface. The engine checks capability with a type assertion and refuses rather than crashing.","triggerScenarios":"Invoking the directory-switch command while the current agent (e.g. one lacking workdir support) fails the `agent.(WorkDirSwitcher)` assertion in renderDirCard.","commonSituations":"User switches to an agent that doesn't support changing working directories and then runs /dir; config assigns a minimal agent implementation to a session where dir features are expected.","solutions":["Switch to an agent that implements WorkDirSwitcher before using the dir command.","Check capability first via `if sw, ok := agent.(WorkDirSwitcher); ok` in any custom command wiring.","Hide or disable the /dir command in the UI/config for agents lacking the capability."],"exampleFix":"// before\nswitcher, ok := agent.(WorkDirSwitcher)\nif !ok { return nil, fmt.Errorf(\"%s\", e.i18n.T(MsgDirNotSupported)) }\n// after (caller-side pre-check)\nif _, ok := agent.(WorkDirSwitcher); !ok {\n    return e.simpleCard(e.i18n.T(MsgDirNotSupported), \"orange\", \"\") // graceful card instead of error\n}","handlingStrategy":"type-guard","validationCode":"_, supported := agent.(WorkDirSwitcher); if !supported { /* hide /dir command for this agent */ }","typeGuard":"if switcher, ok := agent.(WorkDirSwitcher); ok { dir = switcher.GetWorkDir() }","tryCatchPattern":"card, err := e.renderDirCard(key, page)\nif err != nil && strings.Contains(err.Error(), e.i18n.T(MsgDirNotSupported)) {\n    return e.simpleCard(e.i18n.T(MsgDirNotSupported), \"orange\", \"\"), nil // graceful fallback card\n}","preventionTips":["Check capability interfaces before exposing agent-specific commands in the UI.","Document which agents support workdir switching.","Prefer capability-based feature flags over agent-name checks."],"tags":["capability-interface","unsupported-operation","workdir"],"backgroundTag":"unsupported-operation","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"}