{"record":{"id":"30cb18a4534bc8c0","repo":"jackwener/OpenCLI","slug":"linkedin-jobs-preferences-could-not-find-stable-pr","errorCode":null,"errorMessage":"LinkedIn jobs preferences could not find stable preferences content","messagePattern":"LinkedIn jobs preferences could not find stable preferences content","errorType":"error_code","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/jobs-preferences.js","lineNumber":73,"sourceCode":"    return {\n      alerts_url: location.href,\n      job_alerts: Array.from(new Set(alerts)).slice(0, 20),\n      raw_preferences: clean(text).slice(0, 3000),\n    };\n  })()`;\n}\n\nfunction normalizePreferences(preferences, alerts) {\n  if (!preferences || typeof preferences !== 'object') {\n    throw new CommandExecutionError('LinkedIn jobs preferences returned malformed preferences payload');\n  }\n  if (!alerts || typeof alerts !== 'object') {\n    throw new CommandExecutionError('LinkedIn jobs preferences returned malformed alerts payload');\n  }\n  const preferenceText = normalizeWhitespace(preferences.raw_preferences);\n  const alertText = normalizeWhitespace(alerts.raw_preferences);\n  if (!preferenceText && !alertText) {\n    throw new CommandExecutionError('LinkedIn jobs preferences could not find stable preferences content');\n  }\n  return {\n    open_to_work: inferOpenToWork(`${preferenceText} ${alertText}`),\n    job_titles: Array.isArray(preferences.job_titles) ? preferences.job_titles.map(normalizeWhitespace).filter(Boolean).join('; ') : '',\n    locations: Array.isArray(preferences.locations) ? preferences.locations.map(normalizeWhitespace).filter(Boolean).join('; ') : '',\n    job_alerts: Array.isArray(alerts.job_alerts) ? alerts.job_alerts.map(normalizeWhitespace).filter(Boolean).join('; ') : '',\n    preferences_url: normalizeWhitespace(preferences.preferences_url),\n    alerts_url: normalizeWhitespace(alerts.alerts_url),\n    raw_preferences: preferenceText.slice(0, 1200),\n  };\n}\n\ncli({\n  site: 'linkedin',\n  name: 'jobs-preferences',\n  access: 'read',\n  description: 'Read visible LinkedIn Jobs preferences and alert settings without changing them',\n  domain: 'www.linkedin.com',","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/jobs-preferences.js#L55-L91","documentation":"Thrown by normalizePreferences when both normalized preferenceText and alertText are empty — i.e. raw_preferences was blank in both payloads. Unlike the malformed-payload guards, the objects were well-formed but contained no stable textual content to derive open_to_work or preferences columns from.","triggerScenarios":"Both preferences.raw_preferences and alerts.raw_preferences normalize to empty strings: profile has no job preferences set and no alert preferences, or the extraction script grabbed an empty container.","commonSituations":"Fresh/empty LinkedIn profile with Open-to-Work and preferences never configured; extraction script targeting a container that is now empty after a LinkedIn UI change; page captured before content rendered.","solutions":["Configure job preferences and alerts on LinkedIn so the page has content to extract","Increase page.wait after both gotos so content renders before evaluate","Update the extraction script selectors to the current LinkedIn DOM if content exists visually","Treat the empty case as a valid empty result instead of throwing if your use case allows it"],"exampleFix":"// before\nif (!preferenceText && !alertText) {\n  throw new CommandExecutionError('LinkedIn jobs preferences could not find stable preferences content');\n}\n// after\nif (!preferenceText && !alertText) {\n  return { open_to_work: false, job_titles: '', locations: '', job_alerts: '', preferences_url: PREFERENCES_URL, alerts_url: ALERTS_URL, raw_preferences: '' };\n}","handlingStrategy":"fallback","validationCode":"const preferenceText = (preferences && typeof preferences.raw_preferences === 'string') ? preferences.raw_preferences.trim() : '';\nconst alertText = (alerts && typeof alerts.raw_preferences === 'string') ? alerts.raw_preferences.trim() : '';\nif (!preferenceText && !alertText) {\n  console.warn('No preferences content found; returning empty defaults');\n}","typeGuard":"function hasPreferencesContent(preferences, alerts) {\n  return Boolean((preferences && String(preferences.raw_preferences || '').trim()) || (alerts && String(alerts.raw_preferences || '').trim()));\n}","tryCatchPattern":"try {\n  return out(normalizePreferences(preferences, alerts));\n} catch (err) {\n  if (String(err.message).includes('could not find stable preferences content')) {\n    return out({ open_to_work: false, job_titles: '', locations: '', job_alerts: '', preferences_url: PREFERENCES_URL, alerts_url: ALERTS_URL, raw_preferences: '' });\n  }\n  throw err;\n}","preventionTips":["Configure job preferences/alerts on the LinkedIn account before scraping","Increase wait times so content renders before extraction","Update extraction selectors if the page visually shows preferences but extraction is empty","Decide product-wise whether empty preferences should throw or return defaults"],"tags":["linkedin","empty-content","scraping"],"backgroundTag":"empty-extraction-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}