{"record":{"id":"22bde48c527990d3","repo":"FlowiseAI/Flowise","slug":"error-message-22bde4","errorCode":null,"errorMessage":"${error.message}","messagePattern":"\\$\\{error\\.message\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/Spider/SpiderApp.ts","lineNumber":73,"sourceCode":"\n    async scrapeUrl(url: string, params: Params | null = null): Promise<ScrapeResponse> {\n        const headers = this.prepareHeaders()\n        const jsonData: Params = { url, limit: 1, ...params }\n\n        try {\n            const response: AxiosResponse = await this.postRequest('crawl', jsonData, headers)\n            if (response.status === 200) {\n                const responseData = response.data\n                if (responseData[0].status) {\n                    return { success: true, data: responseData[0] }\n                } else {\n                    throw new Error(`Failed to scrape URL. Error: ${responseData.error}`)\n                }\n            } else {\n                this.handleError(response, 'scrape URL')\n            }\n        } catch (error: any) {\n            throw new Error(error.message)\n        }\n        return { success: false, error: 'Internal server error.' }\n    }\n\n    async crawlUrl(url: string, params: Params | null = null, idempotencyKey?: string): Promise<CrawlResponse | any> {\n        const headers = this.prepareHeaders(idempotencyKey)\n        const jsonData: Params = { url, ...params }\n\n        try {\n            const response: AxiosResponse = await this.postRequest('crawl', jsonData, headers)\n            if (response.status === 200) {\n                return { success: true, data: response.data }\n            } else {\n                this.handleError(response, 'start crawl job')\n            }\n        } catch (error: any) {\n            throw new Error(error.message)\n        }","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/Spider/SpiderApp.ts#L55-L91","documentation":"Generic rethrow in scrapeUrl's catch. Any error thrown inside the try (including the structured failure from error 188, handleError's throws, axios/network errors) is flattened to `new Error(error.message)`, destroying the stack trace, error class, and any status code context.","triggerScenarios":"Any exception during scrapeUrl: network timeout, DNS failure, non-200 handled by handleError (which itself throws), or the inner 'Failed to scrape URL' throw being re-caught here.","commonSituations":"Intermittent network issues, Spider 5xx responses, or the inner throw cascading through this outer catch and losing detail.","solutions":["Re-throw the original error instead of wrapping: `throw error` when it is already an Error.","Or attach cause: `throw new Error(msg, { cause: error })` to preserve the stack.","Differentiate axios errors (axios.isAxiosError) to surface status/body.","Handle known recoverable errors (timeout, 429) with retry instead of throw."],"exampleFix":"// before\n} catch (error: any) {\n    throw new Error(error.message)\n}\n\n// after\n} catch (error: any) {\n    if (error instanceof Error) throw error\n    throw new Error(String(error))\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"} catch (error: any) {\n    // preserve the original — do NOT flatten to new Error(error.message)\n    if (error instanceof Error) throw error\n    throw new Error(String(error))\n}","preventionTips":["Never re-wrap an Error into a fresh Error — you lose the stack.","Use `throw error` or `throw new Error(msg, { cause: error })`.","Differentiate axios errors to apply retry/auth logic.","Add structured fields (status, code) to the rethrown error for upstream handling."],"tags":["spider","error-masking","stack-trace","anti-pattern"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}