{"record":{"id":"692b3b8180eea280","repo":"conductor-oss/conductor","slug":"invalid-model-format-s-expected-provider-mod","errorCode":null,"errorMessage":"Invalid model format: '%s'. Expected 'provider/model'.","messagePattern":"Invalid model format: '(.+?)'\\. Expected 'provider/model'\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/org/conductoross/conductor/common/metadata/agent/ModelParser.java","lineNumber":45,"sourceCode":"        private String provider;\n        private String model;\n    }\n\n    /**\n     * Parse a model string like \"openai/gpt-4o\" into provider and model.\n     *\n     * @param modelString The model string in \"provider/model\" format.\n     * @return A ParsedModel with provider and model components.\n     * @throws IllegalArgumentException if the format is invalid.\n     */\n    public static ParsedModel parse(String modelString) {\n        if (modelString == null || modelString.isBlank()) {\n            throw new IllegalArgumentException(\"Model string cannot be null or empty\");\n        }\n\n        int slashIdx = modelString.indexOf('/');\n        if (slashIdx <= 0 || slashIdx >= modelString.length() - 1) {\n            throw new IllegalArgumentException(\n                    \"Invalid model format: '\" + modelString + \"'. Expected 'provider/model'.\");\n        }\n\n        String provider = modelString.substring(0, slashIdx);\n        String model = modelString.substring(slashIdx + 1);\n        return new ParsedModel(provider, model);\n    }\n}\n","sourceCodeStart":27,"sourceCodeEnd":54,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/common/src/main/java/org/conductoross/conductor/common/metadata/agent/ModelParser.java#L27-L54","documentation":"ModelParser.parse requires exactly one '/' separating a non-empty provider and a non-empty model. This error fires when there is no slash, the slash is at the start (empty provider), or the slash is at the end (empty model). The input must match the 'provider/model' shape.","triggerScenarios":"Calling ModelParser.parse with a string like 'gpt-4o' (no slash), '/gpt-4o' (empty provider), 'openai/' (empty model), or 'openai' (no slash).","commonSituations":"Configuring just a model name without the provider prefix; a trailing slash typo; copy-paste that drops the provider segment; a default that only sets the model half.","solutions":["Format the model string as 'provider/model' with both segments non-empty (e.g. 'openai/gpt-4o').","Add the provider prefix if only a bare model name was supplied.","Validate the format (presence and position of '/') before calling parse."],"exampleFix":"// before: missing provider prefix - rejected\nParsedModel m = ModelParser.parse(\"gpt-4o\");\n\n// after: full provider/model form\nParsedModel m = ModelParser.parse(\"openai/gpt-4o\");","handlingStrategy":"validation","validationCode":"// Validate 'provider/model' shape before parsing\nstatic boolean isValidModelFormat(String s) {\n    if (s == null || s.isBlank()) return false;\n    int i = s.indexOf('/');\n    return i > 0 && i < s.length() - 1;\n}\nif (!isValidModelFormat(modelString)) {\n    throw new IllegalArgumentException(\n        \"model must be 'provider/model', got: \" + modelString);\n}","typeGuard":"// Narrow to a well-formed provider/model string\nstatic boolean isValidModelString(String s) {\n    return s != null && !s.isBlank()\n        && s.indexOf('/') > 0 && s.indexOf('/') < s.length() - 1;\n}","tryCatchPattern":"// Catch format errors and report the offending value\ntry {\n    return ModelParser.parse(modelString);\n} catch (IllegalArgumentException e) {\n    throw new BadRequestException(\n        \"Invalid model '\" + modelString + \"'; expected 'provider/model'\", e);\n}","preventionTips":["Always include the provider prefix (e.g. 'openai/gpt-4o').","Validate the slash position before parsing.","Catch and surface the offending model string to the caller."],"tags":["agent","model-parser","validation","input","format"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}