Skip to content

Troubleshooting

Refringe edited this page Oct 28, 2026 · 26 revisions

Troubleshooting

Common issues and their solutions when running Anchor LFS.

Server Won't Start

"failed to load configuration"

The server can't find or parse the config file.

  • Ensure config.toml exists in the working directory, or pass its path with --config (or ANCHOR_LFS_CONFIG)
  • Check for TOML syntax errors (mismatched quotes, missing brackets)
  • Run the server from the directory containing config.toml

When the file loads but its settings are invalid, the log entry's errors field lists every problem found. anchor-lfs check lists the same problems one per line without starting the server. Fix them all before restarting; the entries below explain each message.

"unrecognised keys ..."

The config file contains a key or section the server does not know, usually a typo such as [option] for [options] or visibilty for visibility. The error lists each one by its full name (for example options.data_dir or endpoints.visibilty). Correct the spelling against config.toml.example or the Configuration reference, or remove keys left over from an older version.

"no endpoints configured"

At least one [[endpoints]] block is required in the configuration file.

"ANCHOR_LFS_... must be ..."

An environment variable override has a value the server cannot use. ANCHOR_LFS_MAX_UPLOAD_SIZE takes a positive number of bytes (1073741824, not 1G), and ANCHOR_LFS_S3_PRESIGNED_URLS and ANCHOR_LFS_S3_FORCE_PATH_STYLE take true or false. Correct or unset the variable.

"missing name" / "missing endpoint path"

Every endpoint must have both name and endpoint fields set. An endpoint without a name is identified by its position in the file, such as endpoint #2.

"missing visibility" / "missing authentication"

Every endpoint must set visibility ("public" or "private") and authentication ("github" or "none").

"path ... must start with "/""

The endpoint value is missing its leading slash. Use /org/repo, not org/repo.

"path ... is not a clean path"

The endpoint value has a trailing slash, an empty segment (//), or a dot segment (., ..). The error message suggests the corrected path; for example, /org/repo/ becomes /org/repo.

"duplicate endpoint path"

Two endpoints have the same endpoint path. Each endpoint must have a unique path.

"uses the same storage directory"

Two endpoints map to the same storage directory, so they would share objects and locks. The directory name is the endpoint path without its leading slash, with / replaced by _, compared ignoring case: /org/repo, /org_repo, and /Org/Repo all collide. Rename one of the endpoints. The registered endpoint log line shows each endpoint's directory.

"path is reserved"

The endpoint path conflicts with a reserved server path (/health or /ready), or its storage directory would be one the server already uses in the data directory (/locks or /signing.key). Choose a different path.

"path may only contain letters, digits"

An endpoint path segment contains a character other than letters, digits, ., _ and -, or the path starts with /. or ends with .. A path that mirrors the Git remote, such as /org/repo.git/info/lfs, is allowed.

"URL is not a github.com URL; set github_api_url for GitHub Enterprise"

When using a non-github.com repository URL with authentication = "github", you must also set github_api_url to the GitHub Enterprise API endpoint.

"visibility "private" requires authentication "github""

An endpoint is marked private but uses authentication = "none", which would let anyone read and write it. Either set authentication = "github" to protect it, or set visibility = "public" if it is a local development endpoint that is meant to be open.

"signing_key must be at least 32 bytes (64 hex characters)"

The configured signing key is too short. Generate a proper key:

openssl rand -hex 32

"data directory ... is not writable"

The server process cannot create files in data_directory. The log line includes the uid and gid the server runs as; give that user ownership of the directory. For the Docker image (uid 100, gid 101):

sudo chown -R 100:101 data

On Linux this usually means Docker created ./data as root on first start. See Docker for details. For a systemd install, see Running the Server.

"storage backend requires s3_bucket" / "requires s3_region"

When using S3 storage, both s3_bucket and s3_region are required.

Authentication Issues

401 Unauthorised on All Requests

  • Verify the endpoint's authentication setting is correct
  • Ensure the GitHub PAT hasn't expired
  • Check that the PAT has the required repository permissions
  • For private endpoints, both downloads and uploads require authentication

403 Forbidden ("insufficient permissions")

  • Uploads need a GitHub PAT with push (write) permission on the repository; downloads from a private endpoint need pull (read)
  • The token itself must be allowed to write for uploads and locks, and to read for private downloads, even when your role allows more: a fine-grained token needs Contents: Read and write (or Read-only to download), and a classic token the repo scope (public_repo for public repositories)
  • Uploads and locks on an archived repository are refused
  • A token that cannot see the repository at all gets this error for uploads and locks, and 404 "repository not found" for downloads. Check the endpoint's url names the right repository and the token has been granted access to it (fine-grained tokens list their repositories explicitly)
  • If the organisation uses SAML single sign-on, authorise the token for the organisation in your GitHub token settings
  • Denials are cached for auth_cache_ttl, so a permission fix can take that long to apply

404 "repository not found"

A download from a private endpoint whose token cannot read the repository, which Git LFS reports as "Repository or object not found". The causes and fixes are the same as for 403 "insufficient permissions": the token needs pull on the repository, and a fine-grained token needs Contents: Read-only or more.

429 "authentication service rate limit exceeded"

GitHub is rate limiting the token used to authenticate. Git LFS waits for the Retry-After period and retries. Lower the API traffic by keeping auth_cache_ttl enabled.

502 "authentication service unavailable"

The server could not get an answer from the GitHub API (network failure, DNS, firewall, or a GitHub outage). The server log has the underlying error at warn level.

Authentication Works Intermittently

  • Check auth_cache_ttl as cached results may be stale. Try setting it to "0s" temporarily to disable caching
  • Verify the GitHub API is accessible from the server (check network/firewall rules)

GitHub Enterprise Authentication Fails

  • Ensure github_api_url points at the instance's REST API, usually https://github.example.com/api/v3/
  • Verify the server can reach the GitHub Enterprise instance
  • Check that the PAT was issued by the correct GitHub Enterprise instance

Transfer Issues

"no Git LFS endpoint at this path"

The client's LFS URL does not match any configured endpoint. Check the URL the client is using:

git lfs env | grep Endpoint

It must be the server address followed by the endpoint path exactly, for example https://lfs.example.com/org/repo. Without an explicit lfs.url, Git LFS derives one from the Git remote (such as https://github.com/org/repo.git/info/lfs), which is not an Anchor LFS endpoint. See Git LFS Client Setup.

Uploads Fail with "hash mismatch"

The uploaded file's SHA-256 hash doesn't match the declared OID. With presigned S3 uploads, the storage provider reports this itself as BadDigest. This usually indicates:

  • File corruption during transfer
  • A proxy or middleware is modifying the request body
  • The client computed the hash incorrectly

Uploads Rejected as Too Large

The file exceeds max_upload_size (default: 5 GiB). Increase the limit in configuration:

[options]
max_upload_size = 10737418240  # 10 GiB

Also check your reverse proxy configuration. Nginx defaults to a 1 MB body size limit:

client_max_body_size 0;  # Disable limit

With S3 storage and presigned URLs, objects over 5 GiB are refused with "object exceeds the maximum size for a direct upload to storage", whatever max_upload_size is. Set s3_presigned_urls = false to upload them through the server.

Downloads Return 403 Forbidden

  • The signed URL may have expired. Check url_expiry in your configuration.
  • The signing key may have changed between when the URL was generated and when it was used (e.g., server restart without persisted key, or different key across instances)
  • Without base_url, a URL only works when the request reaches the server with the same scheme and host as the batch request that issued it. If your proxy changes Host or the X-Forwarded-* headers between requests, set base_url. At log_level = "debug", each rejected URL is logged as rejected signed URL with the base_url the server checked it against.

Timeouts on Large Files

If transfers time out, check your reverse proxy timeout settings. Anchor LFS itself has no fixed read/write timeouts, but your proxy might:

Nginx:

proxy_read_timeout 3600s;
proxy_send_timeout 3600s;

Apache:

ProxyTimeout 3600

507 Insufficient Storage

The disk is full or has insufficient space. Free up disk space or switch to S3 storage.

Rate Limiting

429 Too Many Requests

A client IP has made more than rate_limit_tokens batch or lock requests in the current window. The response includes a Retry-After header giving the seconds until the window ends, and Git LFS clients wait that long before retrying. Object downloads and uploads are not rate limited.

Many users behind one NAT or proxy share a single IP and budget. If every request is logged with your reverse proxy's address, the proxy is not in trusted_proxies or does not send X-Forwarded-For; see Reverse Proxy. To allow more requests, raise the token count rather than lengthening the window, since a longer window means a longer wait once the budget runs out:

[options]
rate_limit_tokens = 3000
rate_limit_window = "1m"

S3 Storage Issues

"creating S3 storage adapter" Error

  • Verify s3_bucket and s3_region are set correctly
  • Check that credentials are valid (either explicit or via the AWS credential chain)
  • For custom endpoints, ensure s3_endpoint is a valid URL

"checking storage" at Startup

The server checks storage before it starts listening. For S3 it sends a HeadBucket request, and the error includes the S3 response:

  • 404 or NotFound: the bucket does not exist, or s3_bucket is misspelled
  • 403 or Forbidden: the credentials are wrong, or lack s3:ListBucket on the bucket
  • 301 or a region error: s3_region does not match the bucket's region
  • context deadline exceeded or connection refused: s3_endpoint is wrong or unreachable

For local storage, the error means the data directory does not accept new files; see "data directory ... is not writable" above.

Access Denied on S3 Operations

  • Grant s3:ListBucket on the bucket (arn:aws:s3:::my-lfs-bucket). The startup and readiness checks use it, and without it S3 answers 403 instead of 404 for a missing object.
  • Grant s3:GetObject, s3:PutObject and s3:AbortMultipartUpload on its objects (arn:aws:s3:::my-lfs-bucket/*)
  • Check the bucket policy allows access from the server
  • For presigned URLs, the client needs direct network access to the S3 endpoint

Presigned URLs Not Working

If clients can't access presigned URLs:

  • Ensure the S3 bucket is accessible from the client network
  • Check CORS configuration on the bucket if clients are web-based
  • Uploads failing with SignatureDoesNotMatch mean the client did not send the x-amz-checksum-sha256 header from the upload action, or something between the client and the bucket removed it
  • Try disabling presigned URLs to proxy through the server: s3_presigned_urls = false
  • For S3-compatible services, try enabling path-style addressing: s3_force_path_style = true

URL and Proxy Issues

"base_url is not set" Warning

Warning

Always set base_url in production. Without it, the server relies on X-Forwarded-* headers to construct transfer URLs, increasing the attack surface. Only peers in trusted_proxies can set those headers, but a misconfigured proxy or a client on a trusted network could still influence the generated URLs. See Security for details.

Set base_url in your configuration for production deployments:

[options]
base_url = "https://lfs.example.com"

Without it, the server derives URLs from X-Forwarded-Proto and X-Forwarded-Host headers, which must be set by a reverse proxy listed in trusted_proxies.

Incorrect URLs in Batch Responses

If action URLs in batch responses have the wrong scheme (http instead of https) or hostname:

  1. Set base_url in the configuration (recommended)
  2. Or ensure your reverse proxy sets X-Forwarded-Proto and X-Forwarded-Host correctly

Request Buffering Causes Timeouts

Some reverse proxies buffer the entire request body before forwarding. For large LFS transfers, disable request buffering:

Nginx:

proxy_request_buffering off;
proxy_buffering off;

Logging and Debugging

Enable Debug Logging

[options]
log_format = "console"
log_level = "debug"

This switches from JSON to human-readable lines and adds debug entries, such as successful health checks. Every request is already logged at the default info level unless access_log = false; failed requests appear at warn (4xx) or error (5xx). The environment variables ANCHOR_LFS_LOG_FORMAT and ANCHOR_LFS_LOG_LEVEL do the same without editing the file.

Request Correlation

Every response includes an X-Request-ID header, and error responses repeat it as request_id in the JSON body. The same value appears as request_id on every server log line for that request: the access log entry and anything else logged while handling it. To find them, search the log for the ID:

docker compose logs anchor-lfs | grep a1b2c3d4e5f60718

Git LFS prints the response headers when run with GIT_TRACE=1 GIT_CURL_VERBOSE=1. A batch request and the transfers it hands out are separate requests, so each has its own ID. If your reverse proxy sends its own request ID, the server uses that instead; see Reverse Proxy.

Check Server Health

/health shows the process is running; /ready also checks the data directory and storage:

curl http://localhost:5420/health
# {"status":"ok","version":"v0.2.0"}
curl http://localhost:5420/ready
# {"status":"ready"}

If /ready answers 503, its failed field names the check (data_directory or storage), and the server log has a readiness check failed warning with the cause. In Docker, docker inspect --format '{{json .State.Health}}' <container> shows the latest health check output.

File Locking Issues

Lock Owned by Wrong User

Lock ownership is tied to the GitHub login of the token, not the username Git sends. If using authentication = "none", ownership is the Basic Auth username or "anonymous", and Git LFS sends no username unless lfs.<url>.access is basic (see Endpoints Without Authentication).

Stale Locks

If a lock was left behind (e.g., user forgot to unlock), another user can force-unlock:

git lfs unlock --force path/to/file

Next Steps

Clone this wiki locally

⌂ 换网址