{"record":{"id":"931988c9fbd58f0f","repo":"vitessio/vitess","slug":"cannot-perform-backup-without-my-cnf-please-resta","errorCode":null,"errorMessage":"cannot perform backup without my.cnf, please restart vttablet with a my.cnf file specified","messagePattern":"cannot perform backup without my\\.cnf, please restart vttablet with a my\\.cnf file specified","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletmanager/rpc_backup.go","lineNumber":48,"sourceCode":"\t\"vitess.io/vitess/go/vt/logutil\"\n\t\"vitess.io/vitess/go/vt/mysqlctl\"\n\t\"vitess.io/vitess/go/vt/mysqlctl/backupstats\"\n\t\"vitess.io/vitess/go/vt/topo/topoproto\"\n\t\"vitess.io/vitess/go/vt/vterrors\"\n\n\ttabletmanagerdatapb \"vitess.io/vitess/go/vt/proto/tabletmanagerdata\"\n\ttopodatapb \"vitess.io/vitess/go/vt/proto/topodata\"\n)\n\nconst (\n\tbackupModeOnline  = \"online\"\n\tbackupModeOffline = \"offline\"\n)\n\n// Backup takes a db backup and sends it to the BackupStorage.\nfunc (tm *TabletManager) Backup(ctx context.Context, logger logutil.Logger, req *tabletmanagerdatapb.BackupRequest) error {\n\tif tm.Cnf == nil {\n\t\treturn errors.New(\"cannot perform backup without my.cnf, please restart vttablet with a my.cnf file specified\")\n\t}\n\n\t// Check tablet type current process has.\n\t// During a network partition it is possible that from the topology perspective this is no longer the primary,\n\t// but the process didn't find out about this.\n\t// It is not safe to take backups from tablet in this state\n\tcurrentTablet := tm.Tablet()\n\tif !req.AllowPrimary && currentTablet.Type == topodatapb.TabletType_PRIMARY {\n\t\treturn errors.New(\"type PRIMARY cannot take backup. if you really need to do this, rerun the backup command with --allow-primary\")\n\t}\n\n\tbackupEngine := \"\"\n\tif req.BackupEngine != nil {\n\t\tbackupEngine = *req.BackupEngine\n\t}\n\n\tengine, err := mysqlctl.GetBackupEngine(backupEngine)\n\tif err != nil {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletmanager/rpc_backup.go#L30-L66","documentation":"The Backup RPC on TabletManager requires a parsed my.cnf file (tm.Cnf) to locate mysql directories and run mysqlbackup-compatible backups. This tablet was started without a my.cnf file, so backups cannot be performed.","triggerScenarios":"Calling Backup (via vtctldclient Backup or an automated backup job) against a vttablet process launched without --mycnf-file or with a path that failed to load, leaving tm.Cnf nil.","commonSituations":"Tablets started for pure query serving without backup configuration; missing or misconfigured --mycnf-server-variables/--mycnf-file paths; containers running vttablet without the mysql config mounted.","solutions":["Restart vttablet with --mycnf-file pointing to a valid my.cnf","Verify the my.cnf path is accessible in the container/VM and parses successfully","Use a backup method that does not require my.cnf only if your backup engine supports it"],"exampleFix":"// before\nvttablet -port=15001 ...   # no my.cnf\n// after\nvttablet -port=15001 -mycnf-file=/vt/vtctld/my.cnf ...","handlingStrategy":"validation","validationCode":"if tabletProcessStartedWithoutMycnf() { // e.g. no -mycnf-file\n    skipBackup(tabletAlias) // backups impossible on this tablet\n}","typeGuard":null,"tryCatchPattern":"err := tm.Backup(ctx, logger, req)\nif err != nil && strings.Contains(err.Error(), \"without my.cnf\") {\n    return fmt.Errorf(\"tablet %s not configured for backups; set --mycnf-file\", alias)\n}","preventionTips":["Always launch backup-capable tablets with a valid --mycnf-file","Mount the mysql config in containerized vttablets","Run a preflight backup dry-run in CI for new tablet configs"],"tags":["vttablet","backup","configuration","mycnf"],"backgroundTag":"missing-mycnf-configuration","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}