{"record":{"id":"6ceed195b50d9e0c","repo":"jackwener/OpenCLI","slug":"browser-session-required-for-linkedin-services-rea","errorCode":null,"errorMessage":"Browser session required for linkedin services-read","messagePattern":"Browser session required for linkedin services-read","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/services-read.js","lineNumber":172,"sourceCode":"  await assertLinkedInAuthenticated(page, 'LinkedIn services-read edit');\n  return unwrapEvaluateResult(await page.evaluate(buildServicesEditScript()));\n}\n\ncli({\n  site: 'linkedin',\n  name: 'services-read',\n  access: 'read',\n  description: 'Read LinkedIn Services page details including services, overview, availability, pricing, and media titles/descriptions',\n  domain: 'www.linkedin.com',\n  strategy: Strategy.COOKIE,\n  browser: true,\n  args: [\n    { name: 'profile-url', type: 'string', required: false, help: 'LinkedIn /in/<handle>/ profile URL. Defaults to /in/me/.' },\n    { name: 'services-url', type: 'string', required: false, help: 'LinkedIn /services/page/<id>/ URL. If omitted, it is discovered from the profile.' },\n  ],\n  columns: ['service_url', 'page_title', 'overview', 'availability', 'work_locations', 'pricing', 'services_provided', 'services_count', 'media', 'media_count', 'messages', 'reviews_visibility'],\n  func: async (page, args) => {\n    if (!page) throw new CommandExecutionError('Browser session required for linkedin services-read');\n    let servicesUrl = normalizeWhitespace(args['services-url']);\n    const shouldReadOwnerEdit = !servicesUrl && !normalizeWhitespace(args['profile-url']);\n    if (servicesUrl) {\n      servicesUrl = normalizeServicesUrl(servicesUrl);\n    } else {\n      await page.goto(normalizeProfileUrl(args['profile-url']));\n      await page.wait(5);\n      await assertLinkedInAuthenticated(page, 'LinkedIn services-read profile');\n      const found = unwrapEvaluateResult(await page.evaluate(buildFindServicesUrlScript()));\n      servicesUrl = normalizeWhitespace(found?.services_url);\n      if (!servicesUrl) throw new EmptyResultError('linkedin services-read', 'No LinkedIn Services page link was found on the profile.');\n      servicesUrl = normalizeServicesUrl(servicesUrl);\n    }\n\n    await page.goto(servicesUrl);\n    await page.wait(5);\n    await assertLinkedInAuthenticated(page, 'LinkedIn services-read');\n    const services = unwrapEvaluateResult(await page.evaluate(buildServicesPageScript()));","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/services-read.js#L154-L190","documentation":"The services-read command runs in a browser context and requires an active Playwright/puppeteer-style page. The command's func starts by checking the `page` argument and throws this CommandExecutionError if it is falsy — i.e. the command was invoked without a live browser session.","triggerScenarios":"Invoking linkedin services-read through a runner that does not provision a browser page (headless batch mode without a session, CLI wiring that skipped browser startup, or page creation failed upstream).","commonSituations":"Running the command via a non-interactive runner that passes null for page; browser launch failure silently swallowed upstream; calling the command's func directly in tests without a page fixture.","solutions":["Ensure the CLI/browser session is started before running the command (same session flow used by other linkedin browser commands).","Check upstream logs for browser launch failures (missing Chrome/Chromium, sandbox issues) that leave page null.","In tests, pass a mock page object when calling the command func directly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!page || typeof page.goto !== 'function') {\n  throw new Error('services-read requires an active browser page; start a browser session first');\n}","typeGuard":"function hasBrowserPage(p) {\n  return Boolean(p) && typeof p.goto === 'function' && typeof p.evaluate === 'function';\n}","tryCatchPattern":null,"preventionTips":["Always run linkedin commands through the session-aware runner that provisions `page`.","Check browser launch logs so a failed launch never silently yields page=null.","In tests, inject a mock page with goto/evaluate stubs."],"tags":["linkedin","browser-session","precondition"],"backgroundTag":"missing-browser-session","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}