{"record":{"id":"0bca4fc58904cb66","repo":"databendlabs/databend","slug":"invalid-config-rpc","errorCode":null,"errorMessage":"Invalid config.rpc: {}","messagePattern":"Invalid config\\.rpc: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/binaries/metabench/main.rs","lineNumber":410,"sourceCode":"        benchmark_upsert(client, prefix, client_num, i).await\n    } else if cmd == \"table\" {\n        benchmark_table(client, prefix, client_num, i).await\n    } else if cmd == \"create_tables\" {\n        benchmark_create_tables(client, prefix, client_num, i, param).await\n    } else if cmd == \"batch_create_tables\" {\n        benchmark_batch_create_tables(client, prefix, client_num, i, param).await\n    } else if cmd == \"get_table\" {\n        benchmark_get_table(client, prefix, client_num, i).await\n    } else if cmd == \"get_table_rand\" {\n        benchmark_get_table_rand(client, client_num, i, param).await\n    } else if cmd == \"table_copy_file\" {\n        benchmark_table_copy_file(client, prefix, client_num, i, param).await\n    } else if cmd == \"semaphore\" {\n        benchmark_semaphore(client, prefix, client_num, i, param).await\n    } else if cmd == \"list\" {\n        benchmark_list(client, prefix, client_num, i, param).await\n    } else {\n        unreachable!(\"Invalid config.rpc: {}\", rpc);\n    }\n}\n\nasync fn benchmark_upsert(client: &MetaStore, prefix: u64, client_num: u64, i: u64) -> bool {\n    let node_key = || format!(\"{}-{}-{}\", prefix, client_num, i);\n\n    let seq = MatchSeq::Any;\n    let value = Operation::Update(node_key().as_bytes().to_vec());\n\n    let res = client\n        .upsert_kv(UpsertKV::new(node_key(), seq, value, None))\n        .await;\n\n    print_res(i, \"upsert_kv\", &res);\n    res.is_ok()\n}\n\nasync fn benchmark_table(client: &MetaStore, prefix: u64, client_num: u64, i: u64) -> bool {","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/meta/binaries/metabench/main.rs#L392-L428","documentation":"In metabench's run_benchmark_once, the cmd argument is dispatched over a fixed list of benchmark commands; any unrecognized cmd (driven by an invalid config.rpc value) hits unreachable!(\"Invalid config.rpc: {}\"), crashing the benchmark binary. It guards the assumption that the config only ever names supported benchmark commands.","triggerScenarios":"Setting rpc/cmd in the metabench config to a value outside the supported set (e.g. a typo like 'upserts' instead of 'upsert', or a command removed from the dispatcher) and running the benchmark.","commonSituations":"Hand-edited benchmark configs; configs reused across metabench versions where a command was renamed or removed; adding a new benchmark to the config before implementing its dispatch arm.","solutions":["Check the config.rpc/cmd value against the commands handled in run_benchmark_once and fix the typo.","Add the missing dispatch arm if it is a new benchmark command.","Convert the unreachable! into a graceful error that lists valid options."],"exampleFix":"// before\n_ => unreachable!(\"Invalid config.rpc: {}\", rpc),\n// after\n_ => panic!(\"Invalid config.rpc: {} (supported: upsert, get, list, semaphore, ...)\", rpc),","handlingStrategy":"validation","validationCode":"let supported = [\"upsert\", \"get\", \"list\", \"semaphore\", \"copy\"];\nif !supported.contains(&rpc.as_str()) {\n    panic!(\"Invalid config.rpc: {} (expected one of {:?})\", rpc, supported);\n}","typeGuard":null,"tryCatchPattern":"_ => Err(anyhow::anyhow!(\n    \"Invalid config.rpc: {} (valid: upsert, get, list, semaphore)\", rpc\n)),","preventionTips":["Validate config.rpc against the supported command list before starting the benchmark.","Keep the dispatcher and example config in sync; update both when adding commands.","Copy configs only between metabench versions that share the command set.","Print the list of valid commands in the error message for quick fixes."],"tags":["rust","panic","config","benchmark","cli"],"backgroundTag":"invalid-config-value","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}