glanceapp/glance · error · errNoContent
%w: could not create request with repository: %v
Error message
%w: could not create request with repository: %v
What it means
Returned by fetchRepositoryDetailsFromGithub (internal/glance/widget-repository.go:117) when http.NewRequest for GET https://api.github.com/repos/{repo} fails, wrapped in errNoContent. NewRequest only fails on an unparseable URL, which in practice means the configured repository string contains characters that break URL parsing (control characters, spaces in malformed ways). It is a pre-flight config-level failure, not an HTTP failure — those surface later as 130.
Source
Thrown at internal/glance/widget-repository.go:117
Title string `json:"title"`
} `json:"items"`
}
type gitHubCommitResponseJson struct {
Sha string `json:"sha"`
Commit struct {
Author struct {
Name string `json:"name"`
Date string `json:"date"`
} `json:"author"`
Message string `json:"message"`
} `json:"commit"`
}
func fetchRepositoryDetailsFromGithub(repo string, token string, maxPRs int, maxIssues int, maxCommits int) (repository, error) {
repositoryRequest, err := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/repos/%s", repo), nil)
if err != nil {
return repository{}, fmt.Errorf("%w: could not create request with repository: %v", errNoContent, err)
}
PRsRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/search/issues?q=is:pr+is:open+repo:%s&per_page=%d", repo, maxPRs), nil)
issuesRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/search/issues?q=is:issue+is:open+repo:%s&per_page=%d", repo, maxIssues), nil)
CommitsRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/repos/%s/commits?per_page=%d", repo, maxCommits), nil)
if token != "" {
token = fmt.Sprintf("Bearer %s", token)
repositoryRequest.Header.Add("Authorization", token)
PRsRequest.Header.Add("Authorization", token)
issuesRequest.Header.Add("Authorization", token)
CommitsRequest.Header.Add("Authorization", token)
}
var repositoryResponse githubRepositoryResponseJson
var detailsErr error
var PRsResponse githubTicketResponseJson
var PRsErr errorView on GitHub (pinned to 91324e8de7)
Solutions
- Retype the repository value as a clean 'owner/repo' string
- Check the glance.yml for invisible characters (YAML multiline '>' or '|' scalars, tabs, trailing spaces)
- Read the wrapped %v — Go's url.Parse error pinpoints the offending character position
Example fix
// before (glance.yml)
widget:
type: repository
repository: >
go-gitea/gitea
// after
widget:
type: repository
repository: go-gitea/gitea Defensive patterns
Strategy: validation
Validate before calling
// Reject repo strings that cannot form a valid URL
if strings.ContainsAny(repo, "\n\r\t") || url.PathEscape(repo) != repo {
return errors.New("repository must be a clean owner/name string")
} Try / catch
if err != nil && strings.Contains(err.Error(), "could not create request with repository") {
// config hygiene issue: retype the repository value
} Prevention
- Keep repository values as plain single-line owner/name strings
- Avoid YAML multiline scalars for this field
- Inspect for invisible characters when pasting
When it happens
Trigger: The repo string interpolated into the URL contains control chars, a stray newline from YAML multiline formatting, or other characters that make url.Parse reject the request. Extremely rare with normal 'owner/repo' values.
Common situations: YAML block scalar or trailing whitespace/control character sneaking into the repository key; copy-paste with an invisible character; almost never occurs with hand-typed config.
Related errors
- %w: could not get repository details: %s
- %w: could not get PRs: %s
- %w: could not get issues: %s
- %w: could not get commits: %s
- invalid first day of week
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/f922e0e4bced36f7.
Report an issue: GitHub.