{"record":{"id":"b3c0121a946de2f5","repo":"chenhg5/cc-connect","slug":"marshal-agy-permission-hook-w","errorCode":null,"errorMessage":"marshal Agy permission hook: %w","messagePattern":"marshal Agy permission hook: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"agent/antigravity/permission_bridge.go","lineNumber":151,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"resolve cc-connect executable for Agy hook: %w\", err)\n\t}\n\tbridgeHook, err := json.Marshal(map[string]any{\n\t\t\"PreToolUse\": []any{\n\t\t\tmap[string]any{\n\t\t\t\t\"matcher\": \"*\",\n\t\t\t\t\"hooks\": []any{\n\t\t\t\t\tmap[string]any{\n\t\t\t\t\t\t\"type\":    \"command\",\n\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","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/antigravity/permission_bridge.go#L133-L169","documentation":"createAgyConfigOverlay marshals the bridge hook definition (a Go map) into JSON for embedding in hooks.json. json.Marshal on a map[string]any of plain values practically cannot fail, but if it does, this wrapped error is returned.","triggerScenarios":"newAgyPermissionBridge → createAgyConfigOverlay when json.Marshal of the static bridge-hook structure fails — theoretically only via unusual runtime conditions (e.g. corrupted custom marshalers); in practice near-impossible with the fixed literal structure.","commonSituations":"Rarely seen in the field; would indicate a code-level bug or a custom JSON marshaler injected into the structure rather than a user configuration issue.","solutions":["Rebuild cc-connect from a clean checkout to rule out modified sources or patched dependencies.","Check for any custom json.Marshaler types shadowing the hook structure in a local fork.","Report the wrapped underlying error upstream if it reproduces with an unmodified build."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := startAntigravitySession(); err != nil && strings.Contains(err.Error(), \"marshal Agy permission hook\") {\n    // near-impossible with stock builds; treat as an internal bug and report\n}","preventionTips":["Run unmodified release builds of cc-connect.","Avoid forks that inject custom JSON marshalers into agent internals.","File a bug with the wrapped error if it ever reproduces."],"tags":["json","marshal","antigravity","go"],"backgroundTag":"json-marshal-failed","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}