qeeqbox/social-analyzer · error
error-get-url
error-get-url
Error message
error-get-url
What it means
modules/helper.js get_url_wrapper_text is a thin HTTPS GET helper that returns the literal sentinel string 'error-get-url' (with HTTP 500) whenever the https.get request fails. It is not a thrown Error object but a fallback return value produced by the catch block after request error, timeout, or abort. Callers must compare the returned status/body against this sentinel to detect failure.
Source
Thrown at modules/helper.js:232
data: ''
})
})
request.on('socket', function (socket) {
const timeout = (time !== 0) ? time * 1000 : 5000
socket.setTimeout(timeout, function () {
request.abort()
})
})
})
const response_body = await http_promise
return response_body
} catch (err) {
verbose && console.log(err)
}
}
async function get_url_wrapper_text (url, time = 2) {
const response_body = 'error-get-url'
const ret = 500
try {
const http_promise = new Promise((resolve, reject) => {
const request = https.https.get(url, header_options, function (res) {
let body = ''
res.on('data', function (chunk) {
body += chunk
})
res.on('end', function () {
resolve([res.statusCode,body])
})
})
const timeout = (time !== 0) ? time * 1000 : 5000
request.setTimeout(timeout, function() {
reject({
data: ''
})
});View on GitHub (pinned to 1ba0905e00)
Solutions
- Check the return value for the 'error-get-url' sentinel (and status 500) before parsing the body
- Increase the time parameter (e.g. get_url_wrapper_text(url, 10)) to avoid premature timeouts on slow sites
- Verify the URL is reachable (curl/DNS) and correct; test with a fresh API key or proxy if the site blocks the default header_options
- Confirm outbound HTTPS connectivity (no corporate proxy/firewall blocking Node)
Example fix
// before
const [status, body] = await get_url_wrapper_text(url)
JSON.parse(body)
// after
const ret = await get_url_wrapper_text(url, 10)
if (ret[0] === 500 && ret[1] === 'error-get-url') {
// handle failed fetch: skip site / retry
} else {
JSON.parse(ret[1])
} Defensive patterns
Strategy: fallback
Validate before calling
const urlObj = new URL(url)
if (urlObj.protocol !== 'https:') throw new Error('expected https url')
// optional reachability pre-check
const ok = await new Promise(r => { const req = require('https').request(urlObj, {method:'HEAD', timeout:5000}, res => r(res.statusCode < 500)); req.on('error', () => r(false)); req.on('timeout', () => { req.destroy(); r(false) }); req.end() })
if (!ok) console.warn('site likely unreachable, expect error-get-url') Type guard
function isFetchFailure(ret) {
return Array.isArray(ret) && ret[0] === 500 && ret[1] === 'error-get-url'
} Try / catch
const ret = await get_url_wrapper_text(url, 10)
if (isFetchFailure(ret)) {
// fallback: mark site unreachable, skip or queue retry
} else {
const [status, body] = ret
// consume status/body safely
} Prevention
- Always compare the result against the 'error-get-url' sentinel before parsing JSON
- Pass a generous time argument (>=5s) since the default 2s timeout aborts slow sites
- Pre-validate URLs with new URL() and check https protocol
- Wrap external calls in retry logic with backoff for transient network failures
When it happens
Trigger: Calling get_url_wrapper_text(url) where the HTTPS request emits 'error' (DNS failure, connection refused/refused TLS handshake), the timeout (time*1000 ms, default 2s, or 5s if time===0) fires and calls request.abort(), or the promise rejects with {data:''}.
Common situations: Scanning usernames against sites that are down, rate-limited, or block non-browser agents; invalid or unreachable URLs; too-short timeout (default 2s) on slow sites; no network / proxy issues; sites requiring TLS versions the default agent rejects.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
AI-assisted analysis of qeeqbox/social-analyzer@1ba0905e00 (2026-08-31).
Data as JSON: /api/errors/c2ed6b356190a13d.
Report an issue: GitHub.