glanceapp/glance · error

assets directory does not exist: %s

Error message

assets directory does not exist: %s

What it means

server.assets-path points to a directory that does not exist on disk (checked with os.Stat / IsNotExist). The assets path is where custom CSS/images/logo live, and glance refuses to start with a configured-but-missing directory.

Source

Thrown at internal/glance/config.go:482

		if len(username) < 3 {
			return errors.New("usernames must be at least 3 characters")
		}

		user := config.Auth.Users[username]

		if user.Password == "" {
			if user.PasswordHashString == "" {
				return fmt.Errorf("user %s must have a password or a password-hash set", username)
			}
		} else if len(user.Password) < 6 {
			return fmt.Errorf("the password for %s must be at least 6 characters", username)
		}
	}

	if config.Server.AssetsPath != "" {
		if _, err := os.Stat(config.Server.AssetsPath); os.IsNotExist(err) {
			return fmt.Errorf("assets directory does not exist: %s", config.Server.AssetsPath)
		}
	}

	for i := range config.Pages {
		page := &config.Pages[i]

		if page.Title == "" {
			return fmt.Errorf("page %d has no name", i+1)
		}

		if page.Width != "" && (page.Width != "wide" && page.Width != "slim" && page.Width != "default") {
			return fmt.Errorf("page %d: width can only be either wide or slim", i+1)
		}

		if page.DesktopNavigationWidth != "" {
			if page.DesktopNavigationWidth != "wide" && page.DesktopNavigationWidth != "slim" && page.DesktopNavigationWidth != "default" {
				return fmt.Errorf("page %d: desktop-navigation-width can only be either wide or slim", i+1)
			}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Create the directory (mkdir -p) if it is genuinely missing
  2. Fix the path spelling / make it absolute to avoid cwd ambiguity
  3. In containers, verify the volume mount maps the assets dir to the configured in-container path

Example fix

# before
server:
  assets-path: /config/assets   # not mounted
# after (docker-compose)
# volumes:
#   - ./assets:/config/assets
server:
  assets-path: /config/assets
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Server.AssetsPath != "" {
    if _, err := os.Stat(cfg.Server.AssetsPath); errors.Is(err, fs.ErrNotExist) {
        return fmt.Errorf("create %s before starting", cfg.Server.AssetsPath)
    }
}

Prevention

When it happens

Trigger: Setting assets-path in the server block to a path that is absent, misspelled, or not mounted. Note only IsNotExist triggers this — permission errors on the directory pass this check.

Common situations: Docker deployments where the host assets folder isn't volume-mounted at the path the container expects; relative path resolved from a different working directory; directory created after config written but server started before; typo in the path.

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/4bb5bcaa5c42f868. Report an issue: GitHub.