{"record":{"id":"d3f053b339016f2f","repo":"vitessio/vitess","slug":"w-no-backup-location-set-via-mysql-shell-backu","errorCode":null,"errorMessage":"%w: no backup location set via --mysql-shell-backup-location","messagePattern":"%w: no backup location set via --mysql-shell-backup-location","errorType":"error_code","errorClass":"ErrMySQLShellPreCheck","httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/mysqlshellbackupengine.go","lineNumber":480,"sourceCode":"\treturn false\n}\n\n// backupLocation returns a backup location path by joining the configured\n// mysqlShellBackupLocation with the provided directory and name components.\n// For local filesystem mode, it uses fileutil.SafePathJoin to prevent path\n// traversal outside the configured backup location. For object storage,\n// path.Join is used since SafePathJoin relies on OS-native path operations\n// that don't understand cloud URIs.\nfunc (be *MySQLShellBackupEngine) backupLocation(dir, name string) (string, error) {\n\tif isObjectStoreFlags(mysqlShellDumpFlags) {\n\t\treturn path.Join(mysqlShellBackupLocation, dir, name), nil\n\t}\n\treturn fileutil.SafePathJoin(mysqlShellBackupLocation, dir, name)\n}\n\nfunc (be *MySQLShellBackupEngine) backupPreCheck(location string) error {\n\tif mysqlShellBackupLocation == \"\" {\n\t\treturn fmt.Errorf(\"%w: no backup location set via --mysql-shell-backup-location\", ErrMySQLShellPreCheck)\n\t}\n\n\tif mysqlShellFlags == \"\" || !strings.Contains(mysqlShellFlags, \"--js\") {\n\t\treturn fmt.Errorf(\"%w: at least the --js flag is required in the value of the flag --mysql-shell-flags\", ErrMySQLShellPreCheck)\n\t}\n\n\t// make sure the target directory exists if the target location for the backup is not an object store\n\t// (e.g. is the local filesystem) as MySQL Shell doesn't create the entire path beforehand:\n\tif !isObjectStoreFlags(mysqlShellDumpFlags) {\n\t\terr := os.MkdirAll(location, 0o750)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failure creating directory %s: %w\", location, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/mysqlshellbackupengine.go#L462-L498","documentation":"The MySQL Shell backup engine requires the --mysql-shell-backup-location flag to know where dumps are written. backupPreCheck() returns this error, wrapping ErrMySQLShellPreCheck, when that flag is empty. It fails fast at the start of ExecuteBackup before any expensive dump work begins.","triggerScenarios":"Calling MySQLShellBackupEngine.ExecuteBackup when the `mysql-shell-backup-location` flag (mysqlShellBackupLocation) was never set or is set to empty string.","commonSituations":"Switching a tablet's backup engine to mysqlshell without adding the required flags to the vttablet/vtbackup command line; config templates that omit mysqlshell-specific settings; flags set only on some shards' deployments.","solutions":["Add --mysql-shell-backup-location /path/to/backups to the vttablet/vtbackup startup flags.","Verify the flag value is non-empty in the process environment or config management output (`ps` or flags file).","If the engine should not be mysqlshell, fix the --backup-engine-standalone flag instead."],"exampleFix":"// before: vttablet started without the flag\n--backup-engine-standalone mysqlshell\n// after: supply the required location\n--backup-engine-standalone mysqlshell \\\n  --mysql-shell-backup-location /vt/backups","handlingStrategy":"validation","validationCode":"if backupEngine == \"mysqlshell\" && mysqlShellBackupLocation == \"\" {\n\treturn errors.New(\"--mysql-shell-backup-location is required for the mysqlshell backup engine\")\n}","typeGuard":null,"tryCatchPattern":"err := engine.ExecuteBackup(ctx, backupParams)\nif err != nil {\n\tvar preErr error\n\tif errors.Is(err, mysqlctl.ErrMySQLShellPreCheck) {\n\t\t// config problem, not transient: fail deployment, don't retry\n\t\tpreErr = err\n\t}\n\treturn preErr\n}","preventionTips":["Validate all mysqlshell flags at process startup (PreRunE or config linting).","Keep mysqlshell engine settings in one config template shared by vttablet and vtbackup.","Smoke-test backup in CI with the exact production flag set."],"tags":["backup","mysqlshell","configuration","missing-flag"],"backgroundTag":"missing-flag","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}