JuliusBrussee/caveman · error

githubapp: marshal request: %w

Error message

githubapp: marshal request: %w

What it means

App.do failed to JSON-marshal the request body map before sending it to the GitHub API. The body contains a non-serializable value (func, channel, NaN/Inf) — a caller-side bug in how the request payload was assembled, not a GitHub fault.

Source

Thrown at shared/platform/githubapp/githubapp.go:368

		return 0, nil, fmt.Errorf("githubapp: request path must be a single-host absolute path")
	}
	base, err := url.Parse(a.baseURL)
	if err != nil || base.Scheme == "" || base.Host == "" || base.User != nil {
		return 0, nil, fmt.Errorf("githubapp: invalid base URL")
	}
	relative, err := url.ParseRequestURI(path)
	if err != nil || relative.IsAbs() || relative.Host != "" || relative.User != nil {
		return 0, nil, fmt.Errorf("githubapp: invalid request path")
	}
	target, err := url.Parse(a.baseURL + path)
	if err != nil || target.Scheme != base.Scheme || !strings.EqualFold(target.Host, base.Host) || target.User != nil {
		return 0, nil, fmt.Errorf("githubapp: request path escaped configured host")
	}
	var reader io.Reader
	if body != nil {
		b, err := json.Marshal(body)
		if err != nil {
			return 0, nil, fmt.Errorf("githubapp: marshal request: %w", err)
		}
		reader = bytes.NewReader(b)
	}
	req, err := http.NewRequestWithContext(ctx, method, target.String(), reader)
	if err != nil {
		return 0, nil, fmt.Errorf("githubapp: build request: %w", err)
	}
	req.Header.Set("Authorization", authorization)
	req.Header.Set("Accept", "application/vnd.github+json")
	req.Header.Set("X-GitHub-Api-Version", "2022-11-28")
	if body != nil {
		req.Header.Set("Content-Type", "application/json")
	}
	resp, err := a.httpClient.Do(req)
	if err != nil {
		return 0, nil, fmt.Errorf("githubapp: request failed: %w", err)
	}
	defer resp.Body.Close()

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Pass JSON-serializable body values (maps/structs with basic types)
  2. Fix the body type at the call site; wrap unsupported types in a serializable struct
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shared/platform/githubapp/githubapp.go:368 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/8444ca586becfc11. Report an issue: GitHub.