iflytek/astron-agent · critical

mysql password is empty

Error message

mysql password is empty

What it means

parseMysqlConfig rejects the tenant service configuration when DataBase.Password is empty. Startup fails fast before any DB connection is attempted; fix the deployment's database credential configuration.

Solutions

  1. Set database.password via the mounted secret/env and restart the tenant service
  2. Verify the secret key name matches what the config template expects
  3. Check env var expansion in Compose/Helm isn't producing an empty value
  4. Confirm the MySQL user actually has a password matching the configured value

Example fix

// before
database:
  password: ""
// after
database:
  password: "${MYSQL_PASSWORD}" # injected from secret
Defensive patterns

Strategy: validation

Validate before calling

if conf.DataBase.Password == "" { return errors.New("mysql password must be configured") }

Try / catch

db, err := NewDatabase(conf); if err != nil && strings.Contains(err.Error(), "password is empty") { log.Fatal("MYSQL password missing — check secret mount") }

Prevention

When it happens

Trigger: buildMysql → parseMysqlConfig with database.password empty/missing in config or its secret source.

Common situations: K8s secret not containing the password key, env var interpolation failure (empty ${MYSQL_PASSWORD}), rotated secret not restarted, or a local dev config with the password stripped for the repo.

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


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/9bd95d977fcc8ad7. Report an issue: GitHub.

Appendix: source

Thrown at core/tenant/tools/database/database.go:77

	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
}

func initializeMysqlClient(
	client *sql.DB,

View on GitHub (pinned to 5e758547a8)