conductor-oss/conductor · error · IllegalArgumentException
Model string cannot be null or empty
Error message
Model string cannot be null or empty
What it means
ModelParser.parse rejects a null or blank model string outright. The parser expects a 'provider/model' formatted identifier and fails fast before any splitting when the input is absent or whitespace-only. Mirrors the Python model_parser.
Source
Thrown at common/src/main/java/org/conductoross/conductor/common/metadata/agent/ModelParser.java:40
public class ModelParser {
@Data
@AllArgsConstructor
public static class ParsedModel {
private String provider;
private String model;
}
/**
* Parse a model string like "openai/gpt-4o" into provider and model.
*
* @param modelString The model string in "provider/model" format.
* @return A ParsedModel with provider and model components.
* @throws IllegalArgumentException if the format is invalid.
*/
public static ParsedModel parse(String modelString) {
if (modelString == null || modelString.isBlank()) {
throw new IllegalArgumentException("Model string cannot be null or empty");
}
int slashIdx = modelString.indexOf('/');
if (slashIdx <= 0 || slashIdx >= modelString.length() - 1) {
throw new IllegalArgumentException(
"Invalid model format: '" + modelString + "'. Expected 'provider/model'.");
}
String provider = modelString.substring(0, slashIdx);
String model = modelString.substring(slashIdx + 1);
return new ParsedModel(provider, model);
}
}
View on GitHub (pinned to cf7c3e4a8a)
Solutions
- Provide a non-empty model string in 'provider/model' form (e.g. 'openai/gpt-4o').
- Validate/require the model config field at agent-definition load time.
- Fall back to a documented default model when the configured value is absent.
Example fix
// before: null/blank model throws
ParsedModel m = ModelParser.parse(agent.getModel());
// after: guard then default
String model = agent.getModel();
if (model == null || model.isBlank()) {
model = DEFAULT_MODEL; // e.g. "openai/gpt-4o"
}
ParsedModel m = ModelParser.parse(model); Defensive patterns
Strategy: validation
Validate before calling
// Guard against null/blank before parsing
static boolean isNonBlankModel(String s) {
return s != null && !s.isBlank();
}
if (!isNonBlankModel(modelString)) {
throw new IllegalArgumentException("model must be a non-empty 'provider/model' string");
} Type guard
// Narrow to a present, non-blank model string
static boolean isParsableModelString(String s) {
return s != null && !s.isBlank()
&& s.indexOf('/') > 0 && s.indexOf('/') < s.length() - 1;
} Try / catch
// Catch missing model and apply a default
try {
return ModelParser.parse(modelString);
} catch (IllegalArgumentException e) {
return ModelParser.parse(DEFAULT_MODEL);
} Prevention
- Require a non-empty 'model' field in agent definitions.
- Apply a documented default model when the configured value is absent.
- Validate model config at agent-definition load time.
When it happens
Trigger: Calling ModelParser.parse(null) or ModelParser.parse("") / parse(" ") from agent/AI-task configuration resolution.
Common situations: An agent task definition with a missing or empty 'model' field; a config default that resolves to null; environment variable for the model not set.
Related errors
- Invalid model format: '%s'. Expected 'provider/model'.
- skillRef is required
- workflowDefinition is a string, but not a valid DSL string
- workflowDefinition must be either null, or WorkflowDef, or a
- priority MUST be between 0 and 99 (inclusive)
AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14).
Data as JSON: /api/errors/5ccec2de7b9b8bde.
Report an issue: GitHub.