{"record":{"id":"39341cb82fbc88b8","repo":"FlowiseAI/Flowise","slug":"query-is-required-for-arxiv-search","errorCode":null,"errorMessage":"Query is required for Arxiv search","messagePattern":"Query is required for Arxiv search","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/components/nodes/tools/Arxiv/core.ts","lineNumber":199,"sourceCode":"\n        // Use PDFLoader to extract text (same as Pdf.ts)\n        const loader = new PDFLoader(blob, {\n            splitPages: false,\n            pdfjs: () =>\n                // @ts-ignore\n                this.legacyBuild ? import('pdfjs-dist/legacy/build/pdf.js') : import('pdf-parse/lib/pdf.js/v1.10.100/build/pdf.js')\n        })\n\n        const docs = await loader.load()\n        return docs.map((doc) => doc.pageContent).join('\\n')\n    }\n\n    /** @ignore */\n    async _call(arg: any): Promise<string> {\n        const { query } = arg\n\n        if (!query) {\n            throw new Error('Query is required for Arxiv search')\n        }\n\n        try {\n            const results = await this.fetchResults(query)\n\n            if (results.length === 0) {\n                return 'No good Arxiv Result was found'\n            }\n\n            if (!this.loadFullContent) {\n                // Return summaries only (original behavior)\n                const docs = results.map((result) => {\n                    const publishedDate = result.published ? new Date(result.published).toISOString().split('T')[0] : 'Unknown'\n                    return `Published: ${publishedDate}\\nTitle: ${result.title}\\nAuthors: ${result.authors.join(', ')}\\nSummary: ${\n                        result.summary\n                    }`\n                })\n","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/Arxiv/core.ts#L181-L217","documentation":"Thrown at the top of ArxivTool._call if arg.query is falsy. The query is the only required input for the Arxiv search and is destructured straight from the LLM-supplied arg without coercion. This guards the downstream fetchResults/search-params construction from emitting a malformed request.","triggerScenarios":"The LLM called the tool with an empty object, with unrelated fields, or omitted 'query' entirely; a non-LLM caller invoked the tool directly with no query.","commonSituations":"Weak tool description so the model does not know 'query' is required; prompt that encourages the model to 'search later' and pass empty; programmatic callers that forgot to set query.","solutions":["Make 'query' a required field in the tool's zod schema so a missing value fails earlier with a clearer message.","Improve the tool description: 'Input MUST include a non-empty \"query\" string.'.","Add a few-shot example in the prompt showing a well-formed tool call."],"exampleFix":"// before\nconst { query } = arg\nif (!query) {\n  throw new Error('Query is required for Arxiv search')\n}\n// after: validate at the schema boundary so LangChain surfaces a precise error\nschema = z.object({\n  query: z.string().min(1, 'Query is required for Arxiv search')\n})","handlingStrategy":"validation","validationCode":"function assertArxivQuery(arg: unknown): asserts arg is { query: string } {\n  if (typeof arg !== 'object' || arg === null || typeof (arg as any).query !== 'string' || !(arg as any).query.trim()) {\n    throw new Error('Query is required for Arxiv search')\n  }\n}","typeGuard":"function hasNonEmptyQuery(v: unknown): v is { query: string } {\n  return typeof v === 'object' && v !== null && typeof (v as any).query === 'string' && (v as any).query.trim().length > 0\n}","tryCatchPattern":null,"preventionTips":["Make 'query' a required zod field with min(1) so parsing fails early.","Document the required shape in the tool description and add a few-shot example.","Sanitize LLM output (trim, reject empty) before invoking the tool."],"tags":["validation","arxiv","llm-input","input"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}