gotify/server · error
migrate-config requires one argument: the path to the old co
Error message
migrate-config requires one argument: the path to the old config.yml
What it means
Argument validation error from the migrate-config subcommand (config/migrate/migrate.go Config function). The command converts an old config.yml to the new format and requires exactly one argument — the path to the old config file. An empty path yields this error before any file I/O.
Source
Thrown at config/migrate/migrate.go:76
PassStrength *int
UploadedImagesDir *string
PluginsDir *string
Registration *bool
OIDC struct {
Enabled *bool
Issuer *string
ClientID *string
ClientSecret *string
UsernameClaim *string
RedirectURL *string
AutoRegister *bool
Scopes []string
}
}
func Config(file string) (string, error) {
if file == "" {
return "", errors.New("migrate-config requires one argument: the path to the old config.yml")
}
data, err := os.ReadFile(file)
if err != nil {
return "", fmt.Errorf("cannot read config file %s: %w", file, err)
}
var migrated oldConfig
if err := yaml.Unmarshal(data, &migrated); err != nil {
return "", fmt.Errorf("cannot parse config file %s: %w", file, err)
}
content, err := godotenv.Marshal(buildEnv(migrated))
if err != nil {
return "", fmt.Errorf("cannot render config: %w", err)
}
return content, nil
}View on GitHub (pinned to 14bfc25627)
Solutions
- Invoke migrate-config with the path as its single argument, e.g. gitea migrate-config /etc/gitea-old/config.yml
- Verify the variable holding the path is non-empty before invoking (e.g. [ -n "$OLD_CONF" ] || exit 1)
- Check your flag parsing — ensure the positional path isn't swallowed by a flag definition
- Quote paths with spaces so the shell passes them as one argument
Example fix
# before gitea migrate-config # after gitea migrate-config /etc/gitea/config.yml
Defensive patterns
Strategy: validation
Validate before calling
if len(os.Args) < 2 || os.Args[1] == "" {
fmt.Fprintln(os.Stderr, "usage: migrate-config <path-to-old-config.yml>")
os.Exit(2)
}
oldConf := os.Args[1] Type guard
func hasConfigPathArg(args []string) bool {
return len(args) > 0 && args[0] != ""
} Try / catch
newConf, err := migrate.Config(oldConf)
if err != nil {
if strings.Contains(err.Error(), "requires one argument") {
return fmt.Errorf("usage: migrate-config <path-to-old-config.yml>")
}
return err
} Prevention
- Always pass the old config path explicitly when invoking migrate-config
- Guard scripts with a non-empty check on the path variable before calling the command
- Quote paths containing spaces so they arrive as a single argument
- Check flag parsing so positional arguments are not consumed as flag values
When it happens
Trigger: Running the migrate-config command with no arguments; passing an empty string variable; wiring run/runMigrate so the path argument is dropped (e.g. flag parsing consumed it or os.Args indexing is wrong); tests calling Config("").
Common situations: Forgetting the positional argument in a shell script or Docker CMD; the path stored in an unset env var; migrating run scripts where flags were reordered and the argument ended up empty.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- username claim was empty
- unknown log level
- cannot read config file %s: %w
- read file for %s_FILE (%s): %w
- invalid int for %s (%q): %w
AI-assisted analysis of gotify/server@14bfc25627 (2026-09-05).
Data as JSON: /api/errors/a08c12bfb4fdd6fe.
Report an issue: GitHub.