JuliusBrussee/caveman · error
githubapp: content path is required
Error message
githubapp: content path is required
What it means
Pre-flight validation error from GetFileContent: the required content path argument is empty or whitespace-only. The GitHub contents endpoint needs at least one non-empty path segment, so the call is refused before any installation token is spent.
Solutions
- Validate the path is non-empty at the call site before invoking GetFileContent
- Trace where the path comes from (config/env/DB) — fix the source supplying the empty value
- Pass the repo-relative file path, e.g. "docs/proof.txt", not a directory or absolute path
Example fix
// before
content, err := app.GetFileContent(ctx, tok, owner, name, cfg.ProofPath, ref)
// after
if strings.TrimSpace(cfg.ProofPath) == "" {
return fmt.Errorf("proof path not configured")
}
content, err := app.GetFileContent(ctx, tok, owner, name, strings.Trim(cfg.ProofPath, "/"), ref) Defensive patterns
Strategy: validation
Validate before calling
func validateProofPath(p string) error {
p = strings.TrimSpace(strings.Trim(p, "/"))
if p == "" { return errors.New("content path is required") }
return nil
} Try / catch
if err := validateProofPath(path); err != nil {
return fmt.Errorf("invalid proof path: %w", err)
}
content, err := app.GetFileContent(ctx, tok, owner, name, path, ref) Prevention
- Validate paths from config/env before API calls
- Always pass repo-relative file paths, never directories or "/"
- Fail fast at config load time when a required path is blank
When it happens
Trigger: Calling GetFileContent(ctx, token, owner, name, "", ref) or with path="/" or path=" " — strings.Split(Trim(path,"/"),"/") yields an empty first segment.
Common situations: Path built dynamically from config or database and came out empty (missing config key); upstream caller stripped the path; a directory path of "/" passed instead of a file.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- arm must be or
- artifactId is required
- cannot supersede with empty text
- ccr max storage bytes must be positive
- clickhouse response byte limit must be positive
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/29bd18452eb54d27.
Report an issue: GitHub.
Appendix: 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 3ee70a1026)