chenhg5/cc-connect · warning
marshal Agy permission hook: %w
Error message
marshal Agy permission hook: %w
What it means
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.
Source
Thrown at agent/antigravity/permission_bridge.go:151
if err != nil {
return "", fmt.Errorf("resolve cc-connect executable for Agy hook: %w", err)
}
bridgeHook, err := json.Marshal(map[string]any{
"PreToolUse": []any{
map[string]any{
"matcher": "*",
"hooks": []any{
map[string]any{
"type": "command",
"command": shellQuote(executable) + " _agy-permission-hook",
"timeout": 86400,
},
},
},
},
})
if err != nil {
return "", fmt.Errorf("marshal Agy permission hook: %w", err)
}
hooks[agyPermissionHookName] = bridgeHook
data, err := json.MarshalIndent(hooks, "", " ")
if err != nil {
return "", fmt.Errorf("marshal Agy hooks overlay: %w", err)
}
data = append(data, '\n')
if err := os.WriteFile(filepath.Join(overlayConfigDir, "hooks.json"), data, 0o600); err != nil {
return "", fmt.Errorf("write Agy hooks overlay: %w", err)
}
return overlayConfigRoot, nil
}
func mirrorDirectoryEntries(sourceDir, targetDir string, skip map[string]bool) error {
entries, err := os.ReadDir(sourceDir)
if os.IsNotExist(err) {
return nilView on GitHub (pinned to 4000b2338a)
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.
Defensive patterns
Strategy: try-catch
Try / catch
if err := startAntigravitySession(); err != nil && strings.Contains(err.Error(), "marshal Agy permission hook") {
// near-impossible with stock builds; treat as an internal bug and report
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: json.Marshal / "failed to marshal" errors in Go: why "unsupported type" happens and how to fix it — this error's family across 22 libraries.
Related errors
- marshal Agy hooks overlay: %w
- parse existing Agy hooks %s: %w
- bridge: marshal reconstruct reply ctx: %w
- minimax tts: marshal request: %w
- listen for Agy permission hooks: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/b3c0121a946de2f5.
Report an issue: GitHub.