{"record":{"id":"7492602069d3892e","repo":"dgraph-io/dgraph","slug":"unable-to-handle-url-s","errorCode":null,"errorMessage":"Unable to handle url: %s","messagePattern":"Unable to handle url: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/backup_handler.go","lineNumber":155,"sourceCode":"//\t  secure - true|false turn on/off TLS.\n//\t   trace - true|false turn on/off HTTP tracing.\n//\tcompress - true|false turn on/off data compression.\n//\t encrypt - true|false turn on/off data encryption.\n//\n// Examples:\n//\n//\ts3://dgraph.s3.amazonaws.com/dgraph/backups?secure=true\n//\tminio://localhost:9000/dgraph?secure=true\n//\tfile:///tmp/dgraph/backups\n//\t/tmp/dgraph/backups?compress=gzip\nfunc NewUriHandler(uri *url.URL, creds *x.MinioCredentials) (UriHandler, error) {\n\tswitch uri.Scheme {\n\tcase \"file\", \"\":\n\t\treturn NewFileHandler(uri), nil\n\tcase \"minio\", \"s3\":\n\t\treturn NewS3Handler(uri, creds)\n\t}\n\treturn nil, errors.Errorf(\"Unable to handle url: %s\", uri)\n}\n\n// fileHandler is used for 'file:' URI scheme.\ntype fileHandler struct {\n\trootDir string\n\tprefix  string\n}\n\nfunc NewFileHandler(uri *url.URL) *fileHandler {\n\th := &fileHandler{}\n\th.rootDir, h.prefix = filepath.Split(uri.Path)\n\treturn h\n}\n\nfunc (h *fileHandler) DirExists(path string) bool       { return pathExist(h.JoinPath(path)) }\nfunc (h *fileHandler) FileExists(path string) bool      { return pathExist(h.JoinPath(path)) }\nfunc (h *fileHandler) Read(path string) ([]byte, error) { return os.ReadFile(h.JoinPath(path)) }\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/backup_handler.go#L137-L173","documentation":"NewUriHandler dispatches a backup location URI to a concrete handler based on its scheme. Only file (or empty scheme) and minio/s3 schemes are supported; any other scheme makes it return this error. It is a configuration/URI validation failure, not an I/O failure.","triggerScenarios":"Calling any backup API (runExportBackup, ProcessBackupRequest, WriteBackup, CompleteBackup, ListBackupManifests, VerifyBackup) with a URI whose scheme is not file, minio, or s3 — e.g. gs://, azure://, http://, or a typo like s3s://.","commonSituations":"Typos in the backup location config; copying configs from other tools that use gcs:// or azure:// schemes; forgetting that empty-scheme strings are treated as local file paths; passing a full URL with https:// scheme.","solutions":["Check the configured backup URI scheme; use file:, minio://, or s3:// only.","Fix typos in the scheme (e.g. gcs -> s3, files -> file).","For GCS/Azure targets, use an S3-compatible gateway (minio) or a filesystem mount instead.","Ensure the scheme has no stray spaces or characters in the config value."],"exampleFix":"// before\nuri, _ := url.Parse(\"gcs://my-bucket/backups\")\nh, err := NewUriHandler(uri, creds) // error\n// after\nuri, _ := url.Parse(\"s3://my-bucket/backups\")\nh, err := NewUriHandler(uri, creds)","handlingStrategy":"validation","validationCode":"u, err := url.Parse(backupURI)\nif err != nil { return err }\nswitch u.Scheme {\ncase \"\", \"file\", \"minio\", \"s3\":\n    // ok\ndefault:\n    return fmt.Errorf(\"unsupported backup URI scheme %q: use file:, minio:// or s3://\", u.Scheme)\n}","typeGuard":"func isSupportedBackupURI(u *url.URL) bool {\n    return u != nil && (u.Scheme == \"\" || u.Scheme == \"file\" || u.Scheme == \"minio\" || u.Scheme == \"s3\")\n}","tryCatchPattern":"h, err := NewUriHandler(uri, creds)\nif err != nil {\n    if strings.Contains(err.Error(), \"Unable to handle url\") {\n        return fmt.Errorf(\"backup location %q not supported; supported schemes: file, minio, s3\", uri)\n    }\n    return err\n}","preventionTips":["Validate the backup URI at config-load time, not at request time.","Keep a shared helper that builds backup URIs to avoid scheme typos.","Document supported schemes wherever backup locations are configured.","Add a startup check that constructs NewUriHandler once for the configured location."],"tags":["configuration","uri","backup"],"backgroundTag":"unsupported-uri-scheme","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}