{"record":{"id":"a66838b758517828","repo":"Netflix/chaosmonkey","slug":"s-not-specified-a66838","errorCode":null,"errorMessage":"%s not specified","messagePattern":"(.+?) not specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mysql/mysql.go","lineNumber":67,"sourceCode":"\t\t// See: https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_lock_deadlock\n\t\treturn err.Number == 1213\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// ViolatesMinTime returns true if the error violates min time between\n// terminations\nfunc ViolatesMinTime(err error) bool {\n\t_, ok := errors.Cause(err).(chaosmonkey.ErrViolatesMinTime)\n\treturn ok\n}\n\n// NewFromConfig creates a new MySQL taking config parameters from cfg\nfunc NewFromConfig(cfg *config.Monkey) (MySQL, error) {\n\n\tif cfg.DatabaseHost() == \"\" {\n\t\treturn MySQL{}, errors.Errorf(\"%s not specified\", param.DatabaseHost)\n\t}\n\n\tencryptedPassword := cfg.DatabaseEncryptedPassword()\n\n\tdecryptor, err := deps.GetDecryptor(cfg)\n\tif err != nil {\n\t\treturn MySQL{}, err\n\t}\n\n\tpassword, err := decryptor.Decrypt(encryptedPassword)\n\tif err != nil {\n\t\treturn MySQL{}, err\n\t}\n\n\treturn New(cfg.DatabaseHost(), cfg.DatabasePort(), cfg.DatabaseUser(), password, cfg.DatabaseName())\n}\n\n// New creates a new MySQL","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/mysql/mysql.go#L49-L85","documentation":"NewFromConfig builds a MySQL store from the monkey configuration. It requires a database host; if cfg.DatabaseHost() is empty it immediately returns an error '<param.DatabaseHost> not specified'. The library refuses to construct a MySQL client without knowing which host to connect to.","triggerScenarios":"Calling NewFromConfig (indirectly from Execute) with a config whose database.host (param.DatabaseHost) is empty or unset.","commonSituations":"Missing database.host key in the config file; environment variable supplying the host not set in the deployment environment; typos in the config key so the value never reaches cfg.DatabaseHost().","solutions":["Set the database host in the monkey config (the key matching param.DatabaseHost, e.g. database.host)","Set the corresponding environment variable the config loader reads for the host","Verify the config file being loaded is the intended one and keys are spelled correctly","Add a startup config validation step that fails fast when required DB params are empty"],"exampleFix":"// before (config yaml)\ndatabase:\n  encrypted_password: \"...\"\n// after\ndatabase:\n  host: \"chaosmonkey-db.example.com\"\n  encrypted_password: \"...\"","handlingStrategy":"validation","validationCode":"if cfg.DatabaseHost() == \"\" {\n    return errors.New(\"database.host must be set before constructing the MySQL store\")\n}\nif cfg.DatabaseEncryptedPassword() == \"\" {\n    return errors.New(\"database.encrypted_password must be set\")\n}","typeGuard":null,"tryCatchPattern":"mysql, err := mysql.NewFromConfig(cfg)\nif err != nil {\n    log.Fatalf(\"mysql config incomplete: %v\", err)\n}","preventionTips":["List required DB config keys and check them at process startup","Use config templates/linting so required keys are never missing","Set the host via a documented environment variable in deployments","Fail fast in CI by loading config with a dry-run step"],"tags":["go","mysql","configuration","missing-config"],"backgroundTag":"missing-env-var","analyzedSha":"eaa28fb761c0ebe8644d1333e5d164e9cc3071e9","analyzedAt":"2026-09-03T17:04:39.020Z","contentChangedAt":"2026-09-03T17:04:39.020Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}