{"record":{"id":"58ff18c6ba2fc261","repo":"remix-run/remix","slug":"assetserver-gethref-only-supports-transforms-for","errorCode":null,"errorMessage":"assetServer.getHref() only supports transforms for configured file assets","messagePattern":"assetServer\\.getHref\\(\\) only supports transforms for configured file assets","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/assets/src/lib/asset-server.ts","lineNumber":755,"sourceCode":"        }\n        if (isAssetServerCompilationError(error) && error.code === 'FILE_TRANSFORM_QUERY_INVALID') {\n          return new Response(error.message, {\n            status: 400,\n            headers: { 'Content-Type': 'text/plain; charset=utf-8' },\n          })\n        }\n\n        return responseForError(error)\n      }\n    },\n\n    async getHref(filePath, hrefOptions) {\n      let transform = getHrefTransform(hrefOptions, resolvedOptions.files)\n      let typeCheckFilePath = stripFilePathUrlSuffix(filePath)\n\n      if (isStyleFilePath(typeCheckFilePath)) {\n        if (transform !== null) {\n          throw new TypeError(\n            'assetServer.getHref() only supports transforms for configured file assets',\n          )\n        }\n        return styleCompiler.getHref(filePath)\n      }\n\n      if (fileCompiler?.isServedFilePath(typeCheckFilePath)) {\n        return fileCompiler.getHref(filePath, {\n          transform,\n        })\n      }\n\n      if (!isScriptFilePath(typeCheckFilePath)) {\n        throw createAssetServerCompilationError(`File type is not supported: ${filePath}`, {\n          code: 'FILE_NOT_SUPPORTED',\n        })\n      }\n","sourceCodeStart":737,"sourceCodeEnd":773,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/assets/src/lib/asset-server.ts#L737-L773","documentation":"`remix new` requires exactly one positional: the target directory. `parseNewCommandArgs` allows at most one positional (`maxPositionals: 1`) and throws `RMX_MISSING_TARGET_DIRECTORY` when none is provided. The app name can come from `--app-name`, but the directory itself is mandatory and there is no interactive fallback.","triggerScenarios":"Running `remix new` with zero positionals — `parsed.positionals[0]` is undefined, `targetDir` is null, and the error throws before scaffolding.","commonSituations":"Assuming an interactive prompt will ask for a directory; CI scripts with an empty/unquoted variable for the path; the path accidentally consumed by a preceding flag.","solutions":["Pass the target directory: `remix new my-app`","In scripts, quote and verify the variable is non-empty: `remix new \"$APP_DIR\"`","Optionally add `--app-name` alongside the directory"],"exampleFix":"# before\nremix new\n# after\nremix new my-app","handlingStrategy":"validation","validationCode":"let dir = process.argv[2];\nif (!dir || dir.trim() === '') {\n  console.error('Usage: remix new <target-dir>');\n  process.exit(1);\n}\nrun(['remix','new',dir])","typeGuard":"function isNonEmptyDirArg(dir: string | undefined): dir is string {\n  return typeof dir === 'string' && dir.trim() !== '';\n}","tryCatchPattern":null,"preventionTips":["Always pass an explicit directory","Quote variables in scripts","Don't assume interactive prompts in CLIs"],"tags":["cli","scaffold","argument-missing"],"backgroundTag":"missing-required-argument","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}