Mintplex-Labs/anything-llm · info
Filename is required
Error message
Filename is required
What it means
Returned (HTTP 400) by GET /agent-skills/generated-files/:filename when the filename param is falsy. In practice this is nearly unreachable through Express itself — the :filename route segment cannot match an empty path — so hitting it means the request reached the handler without a real segment: a proxy rewrite that strips it, or programmatic invocation of the route with an empty string.
Solutions
- Request /agent-skills/generated-files/<fileType>-<uuid>.<ext> with a real storage filename taken from the chat artifact link
- Fix proxy rewrite rules so the :filename segment survives forwarding
- Log the full incoming URL server-side to see what actually arrived when this fires
Example fix
# before: proxy strips the segment
location /agent-skills/generated-files/ { proxy_pass http://app/agent-skills/generated-files/; }
# after: preserve the full path
location /agent-skills/generated-files/ { proxy_pass http://app; } Defensive patterns
Strategy: validation
Validate before calling
function downloadUrl(filename) {
if (!filename) throw new Error('storage filename required');
return `/agent-skills/generated-files/${encodeURIComponent(filename)}`;
} Prevention
- Never issue the request without a concrete filename variable in hand
- Test proxy rewrites with a known-good filename before wiring the UI
- Log the arriving full URL server-side if this ever fires — something upstream stripped the segment
When it happens
Trigger: A reverse-proxy rewrite rule that forwards /agent-skills/generated-files/ with the trailing segment stripped; client URL concatenation bugs that drop the filename (usually caught earlier by the router as a plain 404); direct handler tests passing '' as the param.
Common situations: nginx/traefik rewrite misconfigurations; hand-built URL strings with a trailing slash and empty variable interpolation; monitoring probes hitting the bare collection path.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/c74f81c94e01eae5.
Report an issue: GitHub.
Appendix: source
Thrown at server/endpoints/agentFileServer.js:37
* and ownership validation.
*/
function agentFileServerEndpoints(app) {
if (!app) return;
/**
* Download a generated file by its storage filename.
* Validates that the requesting user has access to the workspace
* where the file was generated.
*/
app.get(
"/agent-skills/generated-files/:filename",
[validatedRequest, flexUserRoleValid([ROLES.all])],
async (request, response) => {
try {
const user = await userFromSession(request, response);
const { filename } = request.params;
if (!filename)
return response.status(400).json({ error: "Filename is required" });
// Validate filename format
const parsed = createFilesLib.parseFilename(filename);
if (!parsed) {
return response
.status(400)
.json({ error: "Invalid filename format" });
}
// Find a chat or scheduled job run that references this file
const fileSource = await findFileSource(filename, {
user,
isMultiUser: multiUserMode(response),
});
if (!fileSource) {
return response.status(404).json({
error: "File not found or access denied",View on GitHub (pinned to 3aec848f28)