eyaltoledano/claude-task-master · warning

Error saving research to task/subtask: ${saveError.message}

Error message

Error saving research to task/subtask: ${saveError.message}

What it means

researchDirect attempted to append the generated research output to a task or subtask (via --save-to) and the save call threw. The tool deliberately downgrades this to a warning so the research result is still returned to the caller even though it was not persisted to the task's details. It indicates the research succeeded but the persistence step failed.

Source

Thrown at mcp-server/src/core/direct-functions/research.js:217

						taskIdNum,
						researchContent,
						false, // useResearch = false for simple append
						{
							session,
							mcpLog,
							commandName: 'research-save',
							outputType: 'mcp',
							projectRoot,
							tag
						},
						'json',
						true // appendMode = true
					);

					log.info(`Research saved to task ${saveTo}`);
				}
			} catch (saveError) {
				log.warn(`Error saving research to task/subtask: ${saveError.message}`);
			}
		}

		// Restore normal logging
		disableSilentMode();

		return {
			success: true,
			data: {
				query: result.query,
				result: result.result,
				contextSize: result.contextSize,
				contextTokens: result.contextTokens,
				tokenBreakdown: result.tokenBreakdown,
				systemPromptTokens: result.systemPromptTokens,
				userPromptTokens: result.userPromptTokens,
				totalInputTokens: result.totalInputTokens,
				detailLevel: result.detailLevel,

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Verify the saveTo ID exists (task-master list / show <id>) and correct it.
  2. Check tasks.json exists, is valid JSON, and is writable in the project root.
  3. Re-run the research command; the research text is in the tool response, so paste it manually into the task if saving keeps failing.
  4. Inspect the full saveError via log output to identify the underlying cause (permissions, path, JSON).

Example fix

// before
saveTo = "12.3" // subtask deleted earlier
// after
saveTo = "12" // or an existing subtask ID verified via task-master show
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = await tmCore.tasks.get(saveTo).catch(() => null);
if (!exists) throw new Error(`Cannot save research: task '${saveTo}' not found`);
if (!fs.existsSync(tasksJsonPath)) throw new Error('tasks.json missing from project root');

Type guard

function isTaskId(value) {
  return typeof value === 'string' && /^([A-Z]+-)?\d+(\.\d+)?$/.test(value.trim());
}

Try / catch

try {
  await tmCore.tasks.saveResearchToTask(saveTo, researchText);
} catch (err) {
  log.warn(`Research not saved to '${saveTo}': ${err.message} — keeping result in response only`, { cause: err.message });
}

Prevention

When it happens

Trigger: Calling the research tool with saveTo set to a task/subtask ID that does not exist, a tasks.json that is unwritable or missing, a cross-tag ID that fails resolution, or any exception thrown by the underlying save logic (e.g. JSON parse failure of tasks.json).

Common situations: Typo'd or stale task ID passed to saveTo; tasks.json deleted or corrupted mid-session; file permissions problem after moving the project; subtask ID like '5.2' that no longer exists after restructuring.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/cda70d3b4cd04ffd. Report an issue: GitHub.