{"record":{"id":"a0d7fd5b6f7ad487","repo":"DIYgod/RSSHub","slug":"response-message-a0d7fd","errorCode":null,"errorMessage":"response.message","messagePattern":"response\\.message","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/pornhub/category.ts","lineNumber":52,"sourceCode":"        const { data } = await got(`${defaultDomain}/webmasters/categories`);\n        return data.categories;\n    });\n\n    const categoryId = Number.isNaN(category) ? categories.find((item) => item.category === category)?.id : category;\n    const categoryName = Number.isNaN(category) ? category : categories.find((item) => item.id === Number.parseInt(category)).category;\n\n    const response = await cache.tryGet(\n        `pornhub:category:${categoryName}`,\n        async () => {\n            const { data } = await got(`${defaultDomain}/webmasters/search?category=${categoryName}`);\n            return data;\n        },\n        config.cache.routeExpire,\n        false\n    );\n\n    if (response.code) {\n        throw new Error(response.message);\n    }\n\n    const showImages = img === 'img=1';\n\n    const list = response.videos.map((item) => ({\n        title: item.title,\n        link: item.url,\n        description: renderDescription({ thumbs: item.thumbs }, showImages),\n        pubDate: parseDate(item.publish_date),\n        category: [...new Set([...item.tags.map((t) => t.tag_name), ...item.categories.map((c) => c.category)])],\n    }));\n\n    return {\n        title: `Pornhub - ${categoryName}`,\n        link: `${defaultDomain}/video?c=${categoryId}`,\n        item: list,\n    };\n}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/pornhub/category.ts#L34-L70","documentation":"Plain Error thrown by the Pornhub category handler when the webmasters API response carries a truthy code field. The Pornhub /webmasters/search?category=... endpoint returns an error object (with code and message) instead of a video list on failure; RSSHub re-throws response.message verbatim. Because the message comes from upstream, its exact text varies (e.g. invalid category, rate limit, server error).","triggerScenarios":"The category name passed in :caty does not match any Pornhub webmasters category; Pornhub API rate-limited the instance; transient Pornhub server error; category ID/name resolution produced an empty/invalid categoryName.","commonSituations":"Misspelled category; category removed from Pornhub; cached 'pornhub:categories' list stale so name->id lookup fails; aggressive polling triggering rate limits.","solutions":["Use a category name from https://www.pornhub.com/webmasters/categories.","Clear the 'pornhub:category:{name}' and 'pornhub:categories' cache entries to re-fetch fresh data.","If rate-limited, reduce polling frequency.","Retry once to rule out a transient Pornhub error."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function looksLikeErrorResponse(resp: any): boolean {\n  return Boolean(resp && resp.code);\n}\n// after the cached fetch:\nif (looksLikeErrorResponse(response)) {\n  // surface response.message; optionally clear the 'pornhub:category:{name}' cache\n}","typeGuard":"const isPornhubErrorResponse = (r: unknown): r is { code: number | string; message: string } =>\n  typeof r === 'object' && r !== null && Boolean((r as any).code) && typeof (r as any).message === 'string';","tryCatchPattern":"try {\n  const response = await cache.tryGet(`pornhub:category:${categoryName}`, /* ... */);\n  if (response.code) throw new Error(response.message);\n} catch (e) {\n  // message originates from Pornhub; clear cache and/or advise a valid category\n}","preventionTips":["Use category names from the official webmasters/categories list.","Clear the 'pornhub:categories' and per-category cache when an upstream error appears.","Throttle polling to avoid Pornhub rate-limit responses."],"tags":["pornhub","api","upstream","category","cache"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}