different-ai/openwork · error
Model name is required.
Error message
Model name is required.
What it means
usePullOllamaModel is a React Query mutation hook that wraps the Ollama model pull API. Before calling the backend it trims the user-supplied model name and throws this error when the trimmed value is empty, because Ollama cannot pull a model with no name. It is a client-side guard so an obviously invalid request never reaches the server.
Source
Thrown at apps/app/src/react-app/domains/settings/ollama-config.tsx:175
}
}
return true;
} catch (error) {
onProgress({ status: `Pull failed: ${error instanceof Error ? error.message : String(error)}` });
return false;
}
}
function usePullOllamaModel(options: { onSuccess?: (model: string) => void } = {}) {
const queryClient = useQueryClient();
const [progress, setProgress] = useState<PullProgressState | null>(null);
const { mutateAsync: pullModel, isPending: isPulling } = useMutation({
mutationFn: async (modelName: string) => {
const model = modelName.trim();
if (!model) {
throw new Error("Model name is required.");
}
let latestProgress: PullProgressUpdate = { status: "Starting pull..." };
const updateProgress = (update: PullProgressUpdate) => {
latestProgress = update;
setProgress((current) => ({
modelName: model,
status: update.status,
completed: update.completed ?? current?.completed,
total: update.total ?? current?.total,
}));
};
updateProgress(latestProgress);
const ok = await pullOllamaModel(model, updateProgress);
if (!ok) {
if (latestProgress.status === "Starting pull...") {View on GitHub (pinned to 2b7df46e8a)
Solutions
- Type a valid Ollama model name (e.g. "llama3.2") into the input before pulling
- Guard the call site: only invoke pullModel when the trimmed input is non-empty
- Disable the Pull button while the name field is empty
Example fix
// before pullModel(modelName); // after if (!modelName.trim()) return; pullModel(modelName.trim());
Defensive patterns
Strategy: validation
Validate before calling
const trimmed = modelName.trim();
if (!trimmed) throw new Error("Model name is required.");
pullModel(trimmed); Type guard
const hasModelName = (v: string): v is string => v.trim().length > 0;
Try / catch
try {
await pullModel(name.trim());
} catch (e) {
if (e.message === "Model name is required.") showInputError("Enter a model name");
else throw e;
} Prevention
- Always trim and check non-empty before pulling
- Disable the Pull button while the input is empty
- Add a required-field validation to the form
When it happens
Trigger: Calling pullModel("") or pullModel(" ") — a whitespace-only string — from the Ollama settings UI, typically when the model name input is empty and the user clicks Pull.
Common situations: User clicks the pull button without typing a model name; a form's default value is an empty string; a bound input loses its value; automation/scripts invoke pullModel with an unset variable.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No workspace config files found to export
- Agent context diagnostics timeout must be between 1 ms and 3
- Invalid cloud provider sync response.
- Invalid cloud provider sync status.
- Invalid cloud provider sync status response.
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/f905cd0c63b16ef6.
Report an issue: GitHub.