{"record":{"id":"5c748a3df28e1213","repo":"chenhg5/cc-connect","slug":"work-dir-q-is-not-a-directory","errorCode":null,"errorMessage":"work_dir %q is not a directory","messagePattern":"work_dir %q is not a directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":11451,"sourceCode":"\t\tstate:      state,\n\t\tplatform:   p,\n\t\treplyCtx:   replyCtx,\n\t\tsessionKey: resolvedSessionKey,\n\t}, nil\n}\n\nfunc (e *Engine) resolveSendWorkDir(workDir string) (string, bool, error) {\n\tcurrent := e.currentSendWorkDir()\n\ttarget, err := normalizeSendWorkDir(workDir, current)\n\tif err != nil {\n\t\treturn \"\", false, err\n\t}\n\tinfo, err := os.Stat(target)\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"work_dir %q: %w\", target, err)\n\t}\n\tif !info.IsDir() {\n\t\treturn \"\", false, fmt.Errorf(\"work_dir %q is not a directory\", target)\n\t}\n\n\tif current != \"\" {\n\t\tif normalizedCurrent, err := normalizeSendWorkDir(current, \"\"); err == nil && normalizedCurrent == target {\n\t\t\treturn target, false, nil\n\t\t}\n\t}\n\treturn target, true, nil\n}\n\nfunc (e *Engine) currentSendWorkDir() string {\n\tif e.agent != nil {\n\t\tif wd, ok := e.agent.(interface{ GetWorkDir() string }); ok {\n\t\t\tif dir := strings.TrimSpace(wd.GetWorkDir()); dir != \"\" {\n\t\t\t\treturn dir\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":11433,"sourceCodeEnd":11469,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L11433-L11469","documentation":"resolveSendWorkDir found that the requested work_dir path exists but is a regular file or other non-directory entry. It is an explicit guard rejecting a work_dir parameter pointing at something other than a directory.","triggerScenarios":"Thrown at core/engine.go:11451 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point work_dir at a directory, not a file","Remove/rename the offending file if a directory was intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}