JuliusBrussee/caveman · error

githubapp: content path is required

Error message

githubapp: content path is required

What it means

GetFileContent was called with an empty content path. GitHub's contents endpoint requires at least one non-empty path segment; the guard rejects the malformed request client-side before any network call.

Source

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

	if status != http.StatusOK {
		return out, fmt.Errorf("githubapp: get repo installation %s/%s: HTTP %d: %s", owner, name, status, snippet(raw))
	}
	if err := json.Unmarshal(raw, &out); err != nil {
		return out, fmt.Errorf("githubapp: decode repo installation: %w", err)
	}
	if out.ID <= 0 {
		return Installation{}, fmt.Errorf("githubapp: repo installation response carried no id")
	}
	return out, nil
}

// GetFileContent reads one repository file with an installation token. The
// content endpoint returns base64; callers receive decoded bytes with a strict
// 64 KiB post-decode ceiling because connection proofs are tiny text files.
func (a *App) GetFileContent(ctx context.Context, token, owner, name, path, ref string) ([]byte, error) {
	segments := strings.Split(strings.Trim(path, "/"), "/")
	if len(segments) == 0 || segments[0] == "" {
		return nil, fmt.Errorf("githubapp: content path is required")
	}
	for i := range segments {
		segments[i] = url.PathEscape(segments[i])
	}
	endpoint := "/repos/" + url.PathEscape(owner) + "/" + url.PathEscape(name) + "/contents/" + strings.Join(segments, "/")
	if strings.TrimSpace(ref) != "" {
		endpoint += "?" + url.Values{"ref": {ref}}.Encode()
	}
	status, raw, err := a.do(ctx, "Bearer "+token, http.MethodGet, endpoint, nil)
	if err != nil {
		return nil, err
	}
	if status != http.StatusOK {
		return nil, fmt.Errorf("githubapp: get repository proof: HTTP %d: %s", status, snippet(raw))
	}
	var payload struct {
		Type     string `json:"type"`
		Encoding string `json:"encoding"`

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Pass the actual in-repo file path (e.g. .caveman/proof.txt) when fetching the connection proof
  2. Validate path non-empty at the caller before invoking GetFileContent
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shared/platform/githubapp/githubapp.go:302 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/29bd18452eb54d27. Report an issue: GitHub.