{"record":{"id":"dff1de9c76178bf4","repo":"sveltejs/kit","slug":"route-id-calling-depends-dep-will-thro","errorCode":null,"errorMessage":"${route_id}: Calling `depends('${dep}')` will throw an error in Firefox because `${match[1]}` is a special URI scheme","messagePattern":"(.+?): Calling `depends\\('(.+?)'\\)` will throw an error in Firefox because `(.+?)` is a special URI scheme","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/shared.js","lineNumber":12,"sourceCode":"import * as devalue from 'devalue';\nimport { base64_decode, base64_encode, text_decoder, text_encoder } from './utils.js';\nimport { decoders, encoders } from '#app/internal/transport';\n\n/**\n * @param {string} route_id\n * @param {string} dep\n */\nexport function validate_depends(route_id, dep) {\n\tconst match = /^(moz-icon|view-source|jar):/.exec(dep);\n\tif (match) {\n\t\tconsole.warn(\n\t\t\t`${route_id}: Calling \\`depends('${dep}')\\` will throw an error in Firefox because \\`${match[1]}\\` is a special URI scheme`\n\t\t);\n\t}\n}\n\nexport const INVALIDATED_PARAM = 'x-sveltekit-invalidated';\n\nexport const TRAILING_SLASH_PARAM = 'x-sveltekit-trailing-slash';\n\n/**\n * @param {any} data\n * @param {string} [location_description]\n */\nexport function validate_load_response(data, location_description) {\n\tif (data != null && Object.getPrototypeOf(data) !== Object.prototype) {\n\t\tthrow new Error(\n\t\t\t`a load function ${location_description} returned ${\n\t\t\t\ttypeof data !== 'object'","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/shared.js#L1-L30","documentation":"`depends()` URLs must be ordinary fetchable URLs because SvelteKit uses them for invalidation tracking. Firefox throws for special URI schemes, so SvelteKit warns at dev time when `moz-icon:`, `view-source:`, or `jar:` schemes are used.","triggerScenarios":"Calling `depends('moz-icon:...')`, `depends('view-source:...')`, or `depends('jar:...')` inside a load function (server or universal) identified by `route_id`.","commonSituations":"Constructing dependency keys from user-supplied or file://-ish URLs; passing a resource URI directly instead of an app-relative key; copy-pasted identifiers from browser internals.","solutions":["Use a custom namespaced key like `depends('app:asset:' + id)` instead of a special scheme","Sanitize/reject deps matching /^(moz-icon|view-source|jar):/ before calling depends","Strip the scheme or re-encode the resource reference as a normal path"],"exampleFix":"// before\ndepends('view-source:' + file.path);\n// after\ndepends('app:file:' + encodeURIComponent(file.path));","handlingStrategy":"validation","validationCode":"const FORBIDDEN = /^(moz-icon|view-source|jar):/;\nfunction safeDepends(depends, dep) {\n  if (FORBIDDEN.test(dep)) throw new Error(`Unsupported depends scheme: ${dep}`);\n  depends(dep);\n}","typeGuard":"function isSafeDep(dep) {\n  return typeof dep === 'string' && !/^(moz-icon|view-source|jar):/.test(dep);\n}","tryCatchPattern":null,"preventionTips":["Use app-namespaced keys like 'app:xyz' for depends","Never pass raw file/resource URIs to depends","Lint load functions for special URI schemes"],"tags":["load-functions","depends","firefox","uri-scheme"],"backgroundTag":"special-uri-scheme-dependency","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}