Skip to content

getImage called during astro sync shows non-descriptive error message #16015

@DDeenis

Description

@DDeenis

Astro Info

Astro                    v6.0.8
Vite                     v7.3.1
Node                     v24.12.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

If getImage gets called during the content sync, an error is thrown. While this behaviour is correct (I assume), the error itself says just [object Object]. It is possible to understand that the getImage function causes that, but the exact error is unclear since there is no readable message. I encountered this issue after updating from Astro 5 to Astro 6.

Stack trace:

[GenerateContentTypesError] `astro sync` command failed to generate content collection types: [object Object]
  Error reference:
    https://docs.astro.build/en/reference/errors/generate-content-types-error/
  Location:
    D:\VSCodeProjects\getimage-repro\node_modules\.pnpm\astro@6.0.8_rollup@4.59.0\node_modules\astro\dist\core\sync\index.js:240:11
  Stack trace:
    at syncContentCollections (file:///D:/VSCodeProjects/getimage-repro/node_modules/.pnpm/astro@6.0.8_rollup@4.59.0/node_modules/astro/dist/core/sync/index.js:240:11)
    at async AstroBuilder.setup (file:///D:/VSCodeProjects/getimage-repro/node_modules/.pnpm/astro@6.0.8_rollup@4.59.0/node_modules/astro/dist/core/build/index.js:107:7)
    at async build (file:///D:/VSCodeProjects/getimage-repro/node_modules/.pnpm/astro@6.0.8_rollup@4.59.0/node_modules/astro/dist/core/build/index.js:48:3)
    at async runCommand (file:///D:/VSCodeProjects/getimage-repro/node_modules/.pnpm/astro@6.0.8_rollup@4.59.0/node_modules/astro/dist/cli/index.js:206:7)
  Caused by:
  [object Object]
    at getImage (astro:assets:70:15)
    at async ESModulesEvaluator.runInlinedModule (file:///D:/VSCodeProjects/getimage-repro/node_modules/.pnpm/vite@7.3.1/node_modules/vite/dist/node/module-runner.js:913:3)
    at async ModuleRunner.cachedRequest (file:///D:/VSCodeProjects/getimage-repro/node_modules/.pnpm/vite@7.3.1/node_modules/vite/dist/node/module-runner.js:1053:73)
    at async ESModulesEvaluator.runInlinedModule (file:///D:/VSCodeProjects/getimage-repro/node_modules/.pnpm/vite@7.3.1/node_modules/vite/dist/node/module-runner.js:913:3)
    at async ModuleRunner.cachedRequest (file:///D:/VSCodeProjects/getimage-repro/node_modules/.pnpm/vite@7.3.1/node_modules/vite/dist/node/module-runner.js:1053:73)

What's the expected result?

A descriptive error message saying that getImage is not permitted during the content sync. I believe there is an error message, but it gets reduced to [object Object] somewhere.

Link to Minimal Reproducible Example

https://github.com/DDeenis/astro-getImage-repro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions