{"record":{"id":"e3fc7238a5481ec5","repo":"sveltejs/kit","slug":"asset-file-should-now-be-asset-file-sl","errorCode":null,"errorMessage":"`asset('${file}')` should now be `asset('${file.slice(1)}')`","messagePattern":"`asset\\('(.+?)'\\)` should now be `asset\\('(.+?)'\\)`","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/app/paths/server.js","lineNumber":17,"sourceCode":"import { base, assets, relative } from './internal/server.js';\nimport { resolve_route, find_route } from '../../../utils/routing.js';\nimport { decode_pathname } from '../../../utils/url.js';\nimport { add_data_suffix } from '../../../pathname.js';\nimport { try_get_request_store } from '@sveltejs/kit/internal/server';\nimport { manifest } from '../../server/internal.js';\nimport { get_hooks } from '<sveltekit:generated>/server.js';\nimport { DEV } from 'esm-env';\n\nexport { base, assets, app_dir } from './internal/server.js';\n\n/** @type {typeof import('./client.js').asset} */\nexport function asset(file) {\n\t// TODO 4.0 remove this\n\tif (file[0] === '/') {\n\t\tif (DEV) {\n\t\t\tconsole.warn(`\\`asset('${file}')\\` should now be \\`asset('${file.slice(1)}')\\``);\n\t\t}\n\n\t\tfile = file.slice(1);\n\t}\n\n\treturn assets !== base ? `${assets}/${file}` : resolve(file);\n}\n\n/** @type {typeof import('./client.js').resolve} */\nexport function resolve(id, params) {\n\tlet resolved;\n\n\tif (id[0] === '/') {\n\t\t// route ID\n\t\tif (id.includes('[') && !params) {\n\t\t\tthrow new Error(`Missing params for dynamic route ID ${id}`);\n\t\t}\n","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/app/paths/server.js#L1-L35","documentation":"Server-side twin of the client warning: the SSR version of `asset()` from `$app/paths` now expects paths without a leading slash. A leading slash is stripped with a DEV warning; in future versions it will stop being tolerated.","triggerScenarios":"Calling `asset('/file.css')` in code that runs during server-side rendering (or prerendering); the server `asset()` in packages/kit/src/runtime/app/paths/server.js warns when `file[0] === '/'`.","commonSituations":"Shared components/templates rendering asset URLs during SSR after upgrading from SvelteKit 1.x; email/HTML templates that embed `asset('/...')` links.","solutions":["Drop the leading slash from the argument: `asset('file.css')`","Fix shared modules so both SSR and client paths use the slash-less form"],"exampleFix":"// before\nconst href = asset('/styles/app.css');\n// after\nconst href = asset('styles/app.css');","handlingStrategy":"validation","validationCode":"function safeAssetServer(file) { return asset(file.startsWith('/') ? file.slice(1) : file); }","typeGuard":"function hasLeadingSlash(f) { return typeof f === 'string' && f.startsWith('/'); }","tryCatchPattern":null,"preventionTips":["Keep shared asset helpers slash-less for both SSR and client","Run DEV SSR builds in CI to catch warnings early"],"tags":["deprecation","paths","ssr","assets"],"backgroundTag":"deprecated-asset-path-argument","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}