eyaltoledano/claude-task-master · error · Error
Object name is required for object generation
Error message
Object name is required for object generation
What it means
generateObject requires an objectName string that names the object being generated (used for logging and result extraction in the object response). The error is thrown when params.objectName is missing/empty while schema is present.
Source
Thrown at src/ai-providers/base-provider.js:500
return result;
} catch (error) {
this.handleError('object streaming', error);
}
}
/**
* Generates a structured object using the provider's model
*/
async generateObject(params) {
try {
this.validateParams(params);
this.validateMessages(params.messages);
if (!params.schema) {
throw new Error('Schema is required for object generation');
}
if (!params.objectName) {
throw new Error('Object name is required for object generation');
}
log(
'debug',
`Generating ${this.name} object ('${params.objectName}') with model: ${params.modelId}`
);
const client = await this.getClient(params);
// Get Sentry telemetry config with function ID and metadata for better tracing
// Format: provider.model.command.method.objectName
const commandName = params.commandName || 'unknown';
const functionId = `${this.name}.${params.modelId}.${commandName}.generateObject.${params.objectName}`;
// Build telemetry metadata for enhanced filtering/grouping in Sentry
const metadata = {
command: commandName,
outputType: params.outputType,View on GitHub (pinned to c0c98d367c)
Solutions
- Pass a descriptive objectName string in the params
- Ensure any dynamically computed objectName is non-empty
- Include objectName together with schema — both are required for generateObject
Example fix
// before
await provider.generateObject({ modelId: 'x', messages, schema });
// after
await provider.generateObject({ modelId: 'x', messages, schema, objectName: 'task' }); Defensive patterns
Strategy: validation
Validate before calling
function assertGenerateObjectParams(params) {
if (!params?.schema) throw new Error('generateObject requires params.schema');
if (!params?.objectName || typeof params.objectName !== 'string') throw new Error('generateObject requires a non-empty params.objectName');
} Type guard
function hasObjectName(params) {
return typeof params === 'object' && params !== null && typeof params.objectName === 'string' && params.objectName.length > 0;
} Try / catch
try {
await provider.generateObject(params);
} catch (e) {
if (e.message === 'Object name is required for object generation') {
console.error('params.objectName missing; pass a descriptive name');
} else throw e;
} Prevention
- Include objectName whenever schema is passed to generateObject
- Guard dynamically computed objectName against empty strings
- Centralize generateObject calls in a helper that fills required fields
When it happens
Trigger: Calling provider.generateObject({ modelId, messages, schema }) without objectName, or with objectName: undefined/'' — typically after adding a schema but forgetting the name.
Common situations: Migrating from generateText to generateObject; refactoring call sites where objectName was dropped; dynamically computed objectName evaluating to empty string.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- Parameter validation failed: ${errors.join('; ')}
- Temperature must be between 0 and 1
- maxTokens must be a finite number greater than 0
- Invalid or empty messages array provided
- Schema is required for object generation
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/0f50af576c7c293a.
Report an issue: GitHub.