{"record":{"id":"17e2a4c7984db027","repo":"chenhg5/cc-connect","slug":"create-agy-permission-overlay-w","errorCode":null,"errorMessage":"create Agy permission overlay: %w","messagePattern":"create Agy permission overlay: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/antigravity/permission_bridge.go","lineNumber":108,"sourceCode":"\t\tpending:   make(map[string]chan core.PermissionResult),\n\t}\n\tbridge.wg.Add(1)\n\tgo bridge.acceptLoop()\n\treturn bridge, nil\n}\n\nfunc createAgyConfigOverlay(rootDir string) (string, error) {\n\thomeDir, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"resolve home directory for Agy permission bridge: %w\", err)\n\t}\n\t// Antigravity currently stores its CLI state under .gemini and exposes it\n\t// through the --gemini_dir compatibility flag.\n\trealConfigRoot := filepath.Join(homeDir, \".gemini\")\n\toverlayConfigRoot := filepath.Join(rootDir, \"agy-config\")\n\toverlayConfigDir := filepath.Join(overlayConfigRoot, \"config\")\n\tif err := os.MkdirAll(overlayConfigDir, 0o700); err != nil {\n\t\treturn \"\", fmt.Errorf(\"create Agy permission overlay: %w\", err)\n\t}\n\n\tif err := mirrorDirectoryEntries(realConfigRoot, overlayConfigRoot, map[string]bool{\"config\": true}); err != nil {\n\t\treturn \"\", err\n\t}\n\trealConfigDir := filepath.Join(realConfigRoot, \"config\")\n\tif err := mirrorDirectoryEntries(realConfigDir, overlayConfigDir, map[string]bool{\"hooks.json\": true}); err != nil {\n\t\treturn \"\", err\n\t}\n\n\thooks := make(map[string]json.RawMessage)\n\thooksPath := filepath.Join(realConfigDir, \"hooks.json\")\n\tif data, err := os.ReadFile(hooksPath); err == nil {\n\t\tif err := json.Unmarshal(data, &hooks); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"parse existing Agy hooks %s: %w\", hooksPath, err)\n\t\t}\n\t\tif hooks == nil {\n\t\t\thooks = make(map[string]json.RawMessage)","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/antigravity/permission_bridge.go#L90-L126","documentation":"createAgyConfigOverlay creates the overlay config directory (<rootDir>/agy-config/config) with MkdirAll where the mirrored Antigravity hooks.json will be written. If directory creation fails, the overlay cannot be prepared and this wrapped error is returned.","triggerScenarios":"newAgyPermissionBridge → createAgyConfigOverlay when os.MkdirAll on the temp rootDir's agy-config/config path fails (e.g. parent not writable, disk full, path exists as a file).","commonSituations":"Read-only filesystem or full disk for the temp directory, TMPDIR pointing to a non-writable path, a stale file conflicting with the directory path, or running as a user without write permission to rootDir.","solutions":["Check disk space (df -h) and free space on the filesystem backing rootDir/TMPDIR.","Verify the directory is writable by the cc-connect user; adjust permissions or TMPDIR.","Look for a non-directory file at the target path and remove it.","If the filesystem is mounted read-only (common in read-only containers), point TMPDIR/CC-Connect temp storage at a writable volume."],"exampleFix":"// before\nTMPDIR=/readonly/tmp cc-connect\n// after\nTMPDIR=/var/tmp cc-connect","handlingStrategy":"validation","validationCode":"// Go: ensure the temp root is writable before creating sessions\nd := filepath.Join(os.TempDir(), \"cc-connect-probe\")\nif err := os.MkdirAll(d, 0o700); err != nil {\n    return fmt.Errorf(\"temp dir not writable: %w\", err)\n}\nos.Remove(d)","typeGuard":null,"tryCatchPattern":"if err := startAntigravitySession(); err != nil && strings.Contains(err.Error(), \"create Agy permission overlay\") {\n    // check TMPDIR writability and disk space before retry\n}","preventionTips":["Keep TMPDIR on a writable volume with free space.","Mount /tmp as tmpfs with adequate size in containers.","Monitor disk usage and alert before it fills."],"tags":["filesystem","mkdir","antigravity","go"],"backgroundTag":"mkdir-permission-denied","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"}