{"record":{"id":"54217d8fb2d9825a","repo":"kestra-io/kestra","slug":"invalid-key-pair-value-for-inputs","errorCode":null,"errorMessage":"Invalid key pair value for inputs","messagePattern":"Invalid key pair value for inputs","errorType":"validation","errorClass":"CommandLine.ParameterException","httpStatus":null,"severity":"error","filePath":"cli/src/main/java/io/kestra/cli/commands/flows/FlowTestCommand.java","lineNumber":93,"sourceCode":"    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public Integer call() throws Exception {\n        super.call();\n\n        LocalFlowRepositoryLoader repositoryLoader = applicationContext.getBean(LocalFlowRepositoryLoader.class);\n        FlowRepositoryInterface flowRepository = applicationContext.getBean(FlowRepositoryInterface.class);\n        ExecutionRepositoryInterface executionRepository = applicationContext.getBean(ExecutionRepositoryInterface.class);\n        FlowInputOutput flowInputOutput = applicationContext.getBean(FlowInputOutput.class);\n        TenantIdSelectorService tenantService = applicationContext.getBean(TenantIdSelectorService.class);\n        DispatchQueueInterface<ExecutionCommand> executionCommandQueue = applicationContext.getBean(DispatchQueueInterface.class, Qualifiers.byTypeArguments(ExecutionCommand.class));\n\n        Map<String, Object> inputs = new HashMap<>();\n\n        for (int i = 0; i < this.inputs.size(); i = i + 2) {\n            if (this.inputs.size() <= i + 1) {\n                throw new CommandLine.ParameterException(this.spec.commandLine(), \"Invalid key pair value for inputs\");\n            }\n\n            inputs.put(this.inputs.get(i), this.inputs.get(i + 1));\n        }\n\n        try (StandAloneRunner runner = applicationContext.createBean(StandAloneRunner.class);) {\n            runner.run();\n            repositoryLoader.load(tenantService.getTenantId(tenantId), file.toFile());\n\n            List<Flow> all = flowRepository.findAllForAllTenants();\n            if (all.size() != 1) {\n                throw new IllegalArgumentException(\"Too many flow found, need 1, found \" + all.size());\n            }\n\n            var flow = all.getFirst();\n            var createCommand = Create.of(flow.toFlowId()).withInputsFromReader((executionId) -> flowInputOutput.readExecutionInputs(flow, executionId, inputs));\n            executionCommandQueue.emit(\n                createCommand","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/cli/src/main/java/io/kestra/cli/commands/flows/FlowTestCommand.java#L75-L111","documentation":"Thrown by the 'kestra flow test' CLI command when the --inputs option receives an odd number of tokens. Inputs are parsed as key/value pairs (inputs[i], inputs[i+1]); if the count is not even (size <= i+1 fails), a picocli ParameterException is thrown. This is a usage error, not a runtime fault.","triggerScenarios":"User runs 'flow test --inputs key1 value1 key2' (odd count); the loop detects inputs.size() <= i+1 before pairing and throws CommandLine.ParameterException.","commonSituations":"Typo dropping a value, copy-paste of a single value, a value containing a space that the shell split incorrectly, or forgetting to quote a value with spaces.","solutions":["Provide inputs as an even number of tokens: --inputs key1 value1 key2 value2.","Quote any value containing spaces: --inputs greeting \"hello world\".","Run 'kestra flow test --help' to confirm the expected key/value pairing syntax."],"exampleFix":"# before (odd count)\nkestra flow test myflow.yaml --inputs greeting hello name\n# after (even count, quoted value)\nkestra flow test myflow.yaml --inputs greeting \"hello\" name \"world\"","handlingStrategy":"validation","validationCode":"if (inputs == null || inputs.size() % 2 != 0) {\n  throw new IllegalArgumentException(\"--inputs must be an even number of key/value tokens\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass inputs as key value key value pairs.","Quote values containing spaces.","Run with --help to confirm the expected argument shape."],"tags":["cli","flow-test","inputs","usage","argument-parsing"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}