vitessio/vitess · error

error parsing the json file : %v

Error message

error parsing the json file : %v

What it means

Thrown by cephbackupstorage when the Ceph/S3 credentials config file cannot be JSON-decoded. The package reads a JSON config file (access key, secret key, endpoint, UseSSL) before initializing the MinIO client; if the file contains invalid JSON, Decode fails and the error is wrapped with the parser's message.

Source

Thrown at go/vt/mysqlctl/cephbackupstorage/ceph.go:289

	// TODO(maxeng): return a new CephBackupStorage that uses params.
	return bs
}

// client returns the Ceph Storage client instance.
// If there isn't one yet, it tries to create one.
func (bs *CephBackupStorage) client() (*minio.Client, error) {
	bs.mu.Lock()
	defer bs.mu.Unlock()

	if bs._client == nil {
		configFile, err := os.Open(configFilePath)
		if err != nil {
			return nil, fmt.Errorf("file not present : %v", err)
		}
		defer configFile.Close()
		jsonParser := json.NewDecoder(configFile)
		if err = jsonParser.Decode(&storageConfig); err != nil {
			return nil, fmt.Errorf("error parsing the json file : %v", err)
		}

		accessKey := storageConfig.AccessKey
		secretKey := storageConfig.SecretKey
		url := storageConfig.EndPoint
		useSSL := storageConfig.UseSSL

		client, err := minio.NewV2(url, accessKey, secretKey, useSSL)
		if err != nil {
			return nil, err
		}
		bs._client = client
	}
	return bs._client, nil
}

func init() {
	backupstorage.BackupStorageMap["ceph"] = &CephBackupStorage{}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Open the config file and fix the JSON syntax (validate with `jq . file.json` or `python3 -m json.tool`).
  2. Regenerate the config file from your Ceph/S3 credentials template.
  3. Verify the flag points to the intended JSON file and not a different artifact.
  4. Check file permissions/size — a truncated file (0 bytes or partial) indicates a write/transfer failure.

Example fix

// before (YAML-ish content in config.json)
accessKey: MYKEY
// after
{"AccessKey": "MYKEY", "SecretKey": "SECRET", "EndPoint": "ceph.example.com", "UseSSL": true}
Defensive patterns

Strategy: validation

Validate before calling

data, err := os.ReadFile(configPath)
if err != nil { return err }
var cfg cephStorageConfig
if err := json.Unmarshal(data, &cfg); err != nil {
	return fmt.Errorf("invalid ceph config %s: %w", configPath, err)
}

Try / catch

cfg, err := cephbackupstorage.ListBackups(ctx, ...)
if err != nil && strings.Contains(err.Error(), "error parsing the json file") {
	// fix or regenerate the JSON config and retry
}

Prevention

When it happens

Trigger: Calling ListBackups, StartBackup, or RemoveBackup when the config file pointed at by --ceph-backup-storage-config exists but contains malformed JSON (syntax errors, trailing commas, YAML pasted in, truncated file).

Common situations: Hand-edited Ceph config files, provisioning tools writing partial files, wrong file passed via flag, config file corrupted during transfer.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/22478bc74f3cdfa9. Report an issue: GitHub.