eyaltoledano/claude-task-master · error · Error
Not authenticated
Error message
Not authenticated
What it means
performExport() fetches an access token via authManager.getAccessToken() right before the HTTP call. Unlike errors 140/148 this is a plain Error (not TaskMasterError) thrown when the token is missing even though an earlier session check passed. It means the service reached the network step without a usable bearer token.
Source
Thrown at packages/tm-core/src/modules/integration/services/export.service.ts:688
// Transform tasks to flat structure for API
const flatTasks = this.transformTasksForBulkImport(tasks);
// Prepare request body
const requestBody = {
source: 'task-master-cli',
options: {
dryRun: false,
stopOnError: false
},
accountId: orgId,
tasks: flatTasks
};
// Get auth token
const accessToken = await this.authManager.getAccessToken();
if (!accessToken) {
throw new Error('Not authenticated');
}
// Make API request
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`
},
body: JSON.stringify(requestBody)
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(
`API request failed: ${response.status} - ${errorText}`
);
}View on GitHub (pinned to c0c98d367c)
Solutions
- Re-authenticate with `tm auth login` to obtain a fresh access token.
- Clear credentials and log in again if the token store appears corrupted.
- Ensure no concurrent logout/token-clear runs during the export (e.g. parallel CLI invocations).
- Catch this Error and treat it as an auth failure by redirecting the user to login.
Example fix
// before await exportService.exportTasks(options); // may throw raw 'Not authenticated' // after const token = await tmCore.auth.getAccessToken(); if (!token) await tmCore.auth.login(); await exportService.exportTasks(options);
Defensive patterns
Strategy: try-catch
Validate before calling
const accessToken = await tmCore.auth.getAccessToken();
if (!accessToken) {
throw new Error('No access token — run `tm auth login` before exporting');
} Try / catch
try {
await exportService.exportTasks(options);
} catch (e) {
if (e instanceof Error && e.message === 'Not authenticated') {
// raw Error, not TaskMasterError — recover by re-authenticating
await tmCore.auth.login();
return exportService.exportTasks(options);
}
throw e;
} Prevention
- Check getAccessToken() (not just session validity) before long export operations
- Avoid running logout/login concurrently with exports in the same profile
- Re-login if credentials were provisioned long ago; tokens may have been revoked
- In CI, fetch a fresh token at job start rather than reusing cached state
When it happens
Trigger: Calling exportTasks() where hasValidSession() returned true but getAccessToken() returns null — e.g. a session record exists but the token was cleared, a partially-completed login, or token storage corrupted between the two checks.
Common situations: Race with logout in another process; corrupted or partially-written credential store; custom auth integration that reports a valid session without provisioning an access token; token revoked server-side after the session check.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- AUTHENTICATION_ERROR
- MFA_VERIFICATION_FAILED
- MCP Provider requires active MCP session
- AUTHENTICATION_ERROR
- FLOW_NOT_FOUND
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/db29f12d994cb859.
Report an issue: GitHub.