{"record":{"id":"ae3ef9b0e64cf7dc","repo":"chenhg5/cc-connect","slug":"write-agy-hooks-overlay-w","errorCode":null,"errorMessage":"write Agy hooks overlay: %w","messagePattern":"write Agy hooks overlay: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/antigravity/permission_bridge.go","lineNumber":161,"sourceCode":"\t\t\t\t\t\t\"command\": shellQuote(executable) + \" _agy-permission-hook\",\n\t\t\t\t\t\t\"timeout\": 86400,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"marshal Agy permission hook: %w\", err)\n\t}\n\thooks[agyPermissionHookName] = bridgeHook\n\n\tdata, err := json.MarshalIndent(hooks, \"\", \"  \")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"marshal Agy hooks overlay: %w\", err)\n\t}\n\tdata = append(data, '\\n')\n\tif err := os.WriteFile(filepath.Join(overlayConfigDir, \"hooks.json\"), data, 0o600); err != nil {\n\t\treturn \"\", fmt.Errorf(\"write Agy hooks overlay: %w\", err)\n\t}\n\treturn overlayConfigRoot, nil\n}\n\nfunc mirrorDirectoryEntries(sourceDir, targetDir string, skip map[string]bool) error {\n\tentries, err := os.ReadDir(sourceDir)\n\tif os.IsNotExist(err) {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read Agy config directory %s: %w\", sourceDir, err)\n\t}\n\tfor _, entry := range entries {\n\t\tif skip[entry.Name()] {\n\t\t\tcontinue\n\t\t}\n\t\tsource := filepath.Join(sourceDir, entry.Name())\n\t\ttarget := filepath.Join(targetDir, entry.Name())","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/antigravity/permission_bridge.go#L143-L179","documentation":"createAgyConfigOverlay writes the final merged hooks JSON to <rootDir>/agy-config/config/hooks.json with mode 0600. If os.WriteFile fails, the overlay is incomplete and this wrapped error is returned, aborting bridge creation.","triggerScenarios":"newAgyPermissionBridge → createAgyConfigOverlay when writing the overlay hooks.json fails: disk full, read-only filesystem, or the file/dir permissions changed between MkdirAll and WriteFile.","commonSituations":"Full disk on the temp volume, TMPDIR on a read-only mount, aggressive security software locking new files, or quota limits on the temp filesystem.","solutions":["Check free space on the filesystem backing rootDir/TMPDIR (df -h) and free up space if needed.","Point TMPDIR (or the cc-connect temp root) at a writable volume and retry.","Verify the agy-config/config directory created moments earlier is still writable (no concurrent chmod/AV interference).","Re-run the session start once transient I/O errors (EINTR, NFS hiccups) have cleared."],"exampleFix":"// before: read-only temp volume\n$ df -h /tmp → 100% full\n// after\ncleanup /tmp or TMPDIR=/var/tmp cc-connect","handlingStrategy":"retry","validationCode":"// shell: confirm the temp volume has space and is writable before start\n[ -w \"${TMPDIR:-/tmp}\" ] && [ \"$(df --output=pcent \"${TMPDIR:-/tmp}\" | tail -1 | tr -dc 0-9)\" -lt 95 ] \\\n  || echo \"temp volume not writable or nearly full\"","typeGuard":null,"tryCatchPattern":"if err := startAntigravitySession(); err != nil && strings.Contains(err.Error(), \"write Agy hooks overlay\") {\n    // free disk space or relocate TMPDIR, then retry once\n}","preventionTips":["Monitor free space on the temp filesystem.","Use tmpfs or a dedicated writable volume for TMPDIR.","Exclude cc-connect temp paths from antivirus real-time locking."],"tags":["filesystem","file-write","antigravity","go"],"backgroundTag":"file-write-failed","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"}