cayleygraph/cayley · error
could not get resource <%s>: %v
Error message
could not get resource <%s>: %v
What it means
QuadReaderFor treats a path with a URL scheme as a remote resource and fetches it with http.Get. If the HTTP request itself fails at the transport level (DNS failure, connection refused, TLS error, timeouts), the error is wrapped as this message with the URL and cause.
Source
Thrown at internal/load.go:66
if path == "-" {
r = os.Stdin
} else if u, err := url.Parse(path); err != nil || u.Scheme == "file" || u.Scheme == "" {
// Don't alter relative URL path or non-URL path parameter.
if u.Scheme != "" && err == nil {
// Recovery heuristic for mistyping "file://path/to/file".
path = filepath.Join(u.Host, u.Path)
}
f, err := os.Open(path)
if os.IsNotExist(err) {
return nil, err
} else if err != nil {
return nil, fmt.Errorf("could not open file %q: %v", path, err)
}
r, c = f, f
} else {
res, err := http.Get(path)
if err != nil {
return nil, fmt.Errorf("could not get resource <%s>: %v", u, err)
}
// TODO(dennwc): save content type for format auto-detection
r, c = res.Body, res.Body
}
r, err := decompressor.New(r)
if err != nil {
if c != nil {
c.Close()
}
if err == io.EOF {
return nopCloser{quad.NewReader(nil)}, nil
}
return nil, err
}
var qr quad.ReadCloser
switch typ {View on GitHub (pinned to 81dcd7d73e)
Solutions
- Check the wrapped cause for DNS/connection/TLS specifics
- Verify the URL is reachable (curl the same URL from the host)
- Configure HTTP(S)_PROXY env vars if a proxy is required
- If you only intended a local file, remove the URL scheme so it is treated as a path
Example fix
// before ./cayley load --data http://exmaple.com/data.nq # DNS typo // after ./cayley load --data http://example.com/data.nq
Defensive patterns
Strategy: retry
Validate before calling
u, err := url.Parse(path)
if err == nil && u.Scheme != "" {
resp, err := http.Head(path)
if err != nil || resp.StatusCode >= 400 {
return fmt.Errorf("data URL unreachable: %v", err)
}
} Try / catch
r, err := internal.QuadReaderFor(ctx, path)
if err != nil && strings.Contains(err.Error(), "could not get resource") {
// back off and retry; or fall back to a local copy
} Prevention
- Pre-download remote datasets to local files before loading
- Set HTTP(S)_PROXY when behind a proxy
- Use curl/HEAD checks in deployment scripts before starting loads
When it happens
Trigger: Loading data from http:// or https:// URLs when the server is unreachable, the hostname doesn't resolve, or the TLS handshake fails.
Common situations: Behind a firewall/proxy without proxy env vars set; typo in hostname; remote server down; self-signed certificates rejected by the Go HTTP client.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- no support for HTTP interface for this query language
- request is too large
- request is too large
- HTTP interface is not supported for this query language
- invalid quad at index %d. %s
AI-assisted analysis of cayleygraph/cayley@81dcd7d73e (2026-09-06).
Data as JSON: /api/errors/23bed4d5143157a3.
Report an issue: GitHub.