iflytek/astron-agent · critical
mysql username is empty
Error message
mysql username is empty
What it means
parseMysqlConfig rejects the tenant service configuration when DataBase.UserName is empty, failing fast before building the DSN/connection. It is a startup config guard — the MySQL client cannot be constructed without credentials.
Solutions
- Set database.userName in the tenant service config or its backing env/secret
- Verify the secret/config is mounted and readable by the tenant service pod
- Re-check Compose/Helm values that template the MySQL username
- Restart the service after supplying the username
Example fix
// before database: userName: "" // after database: userName: "tenant_user"
Defensive patterns
Strategy: validation
Validate before calling
if conf.DataBase.UserName == "" { return errors.New("mysql username must be configured") } Try / catch
if _, _, err := parseMysqlConfig(conf); err != nil { log.Fatalf("mysql config invalid: %v", err) } Prevention
- Inject DB credentials via secrets, never hardcode
- Add a startup config sanity check for user/password/url
- Verify secret mounts in deployment manifests
When it happens
Trigger: buildMysql → parseMysqlConfig with a config whose database.userName is empty or absent.
Common situations: MySQL credential env var not injected into the container, Helm/Compose secret not mounted, key typo in config file, or default config template with empty username.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- mysql url is empty
- database config is nil or dbType is empty
- mysql password is empty
- mysql database name is empty
- check tenant bootstrap managed credential failed
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/ff79237265475f41.
Report an issue: GitHub.
Appendix: source
Thrown at core/tenant/tools/database/database.go:74
}
client.SetMaxOpenConns(conf.DataBase.MaxOpenConns)
client.SetMaxIdleConns(conf.DataBase.MaxIdleConns)
if err := client.Ping(); err != nil {
return err
}
if err := initializeMysqlClient(client, conf.TenantBootstrap); err != nil {
_ = client.Close()
return err
}
db.mysql = client
return nil
}
func parseMysqlConfig(conf *config.Config) (string, *mysql.Config, error) {
if len(conf.DataBase.UserName) == 0 {
return "", nil, errors.New("mysql username is empty")
}
if len(conf.DataBase.Password) == 0 {
return "", nil, errors.New("mysql password is empty")
}
if len(conf.DataBase.Url) == 0 {
return "", nil, errors.New("mysql url is empty")
}
if err := conf.TenantBootstrap.Validate(); err != nil {
return "", nil, fmt.Errorf("invalid tenant bootstrap credentials: %w", err)
}
dsn := fmt.Sprintf("%s:%s@tcp%s", conf.DataBase.UserName, conf.DataBase.Password, conf.DataBase.Url)
parsedDsn, err := mysql.ParseDSN(dsn)
if err != nil {
return "", nil, err
}
return dsn, parsedDsn, nil
}View on GitHub (pinned to 5e758547a8)