{"record":{"id":"3672c1baf648aa77","repo":"jackwener/OpenCLI","slug":"result-message-failed-to-remove-like","errorCode":null,"errorMessage":"result.message || 'Failed to remove like'","messagePattern":"result\\.message \\|\\| 'Failed to remove like'","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/youtube/unlike.js","lineNumber":63,"sourceCode":"          },\n          body: JSON.stringify({ context, target: { videoId: ${JSON.stringify(videoId)} } }),\n        });\n\n        if (resp.status === 401 || resp.status === 403) return { error: 'auth', message: 'Not logged in' };\n        if (!resp.ok) {\n          const body = await resp.json().catch(() => ({}));\n          const errStatus = body?.error?.status || '';\n          if (errStatus === 'UNAUTHENTICATED') return { error: 'auth', message: 'Not logged in' };\n          return { error: 'http', message: 'HTTP ' + resp.status + (errStatus ? ' ' + errStatus : '') };\n        }\n        return { ok: true };\n      })()\n    `);\n        if (result?.error === 'auth') {\n            throw new AuthRequiredError('www.youtube.com');\n        }\n        if (result?.error) {\n            throw new CommandExecutionError(result.message || 'Failed to remove like');\n        }\n        return [{ status: 'success', message: 'Unliked: ' + videoId }];\n    },\n});\n","sourceCodeStart":45,"sourceCodeEnd":68,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/youtube/unlike.js#L45-L68","documentation":"CommandExecutionError raised when the in-page unlike command returned a generic error that was not auth-related. The thrown message is result.message when the page evaluation provided one, otherwise the fallback 'Failed to remove like'. It wraps any non-auth failure (HTTP error, missing config, unexpected response shape) from the page-side API call.","triggerScenarios":"result.error is truthy and not 'auth' — e.g. the internal removelike fetch returned a non-OK HTTP status ('HTTP 400/403/500'), INNERTUBE_API_KEY was absent from ytcfg, or the response JSON could not be interpreted.","commonSituations":"YouTube internal API returning 400/403 (bot detection, consent walls, region blocks); ytcfg.data_ missing INNERTUBE_API_KEY because the page did not fully load; videoId invalid or video in unexpected state; network failure or timeout inside page.evaluate.","solutions":["Inspect result.message in the caught error to see the underlying HTTP status or page-side failure detail.","Re-run prepareYoutubeApiPage so the page (and ytcfg/INNERTUBE_API_KEY) is fully loaded before evaluating.","Retry after a delay — transient 5xx or bot-detection challenges often resolve; consider slower pacing between like/unlike calls.","Verify the video URL parses to a valid videoId and the video still exists; log in if the error turns out to be auth-flavored."],"exampleFix":"// before\nawait unlike(kwargs); // throws CommandExecutionError with fallback message\n// after\ntry {\n  await unlike(kwargs);\n} catch (e) {\n  if (e.name === 'CommandExecutionError') {\n    console.error('unlike failed:', e.message); // e.g. 'HTTP 403 ...'\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await unlike({ url });\n} catch (e) {\n  if (e.name === 'CommandExecutionError') {\n    if (/HTTP 5\\d\\d/.test(e.message)) return retryWithBackoff(() => unlike({ url }));\n    console.error('unlike failed:', e.message);\n  }\n  throw e;\n}","preventionTips":["Always inspect e.message to get the underlying page-side failure detail (e.g. HTTP status).","Fully load the YouTube page (prepareYoutubeApiPage) before running in-page commands.","Pace like/unlike operations and add retries for transient 5xx/bot-detection responses.","Validate video URLs resolve to a real videoId before invoking the command."],"tags":["youtube","browser","command-execution","http-error"],"backgroundTag":"command-execution-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}