owasp-amass/amass · error
expected 'database' to be a string, got %T
Error message
expected 'database' to be a string, got %T
What it means
loadDatabaseSettings found a value under the 'database' option key whose Go type is not string (the %T verb shows the actual type, e.g. map or float from YAML). The subsequent dbURIInterface.(string) assertion fails, so the database URI cannot be parsed or passed to loadDatabase.
Solutions
- Write the 'database' setting as a URI string, e.g. "postgres://user:pass@host:5432/dbname"
- If YAML anchors or nesting produced a map, flatten it to a single URI string
- Validate the config schema up front so non-string 'database' values are rejected with a location hint
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at config/graphdb.go:49 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/39030567bbdba4ba.
Report an issue: GitHub.
Appendix: source
Thrown at config/graphdb.go:49
assetPort = "AMASS_DB_PORT"
assetDBName = "AMASS_DB_NAME"
)
func (c *Config) loadDatabaseSettings(cfg *Config) error {
if c.Options == nil {
return fmt.Errorf("config options are not initialized")
}
dbURIInterface, ok := c.Options["database"]
if !ok {
if err := c.LoadDatabaseEnvSettings(); err != nil {
return nil
}
}
dbURI, ok := dbURIInterface.(string)
if !ok {
return fmt.Errorf("expected 'database' to be a string, got %T", dbURIInterface)
}
if _, err := url.Parse(dbURI); err == nil {
if err := c.loadDatabase(dbURI); err != nil {
return err
}
}
return nil
}
// LoadDatabaseEnvSettings initializes the DB structure with the Environment variables.
func (c *Config) LoadDatabaseEnvSettings() error {
dbURI := ""
db := &Database{
Primary: true,
System: "postgres",
}
View on GitHub (pinned to 79299dce87)