Why does Tinymist not find packages?

Tinymist can’t find directory with packages. This problem occurs in all files:

“package not found (searched for @preview/cetz:0.4.0)”


#import "@preview/cetz:0.4.0"

#cetz.canvas({
  import cetz.draw: *
  circle((0, 0))
})

Versions of Typst and Tinymist are latest.

The command “typst compile main.typ” works fine via the terminal. But it doesn’t work in VS Code.

Hi @eee, welcome and thank you for your question! I have changed your post’s title to bring it in line with the question guidelines and thus make it easier to understand from the title:

Good titles are questions you would ask your friend about Typst.

I also added the tinymist tag, as it makes your question easier to find.


To your question – I have copied that code into my VS Code and the preview was shown without problem.

  • Have you tried restarting VS Code, and your computer?
  • Is there anything in the locations indicated here? I would be surprised if there’s anything wrong with the files there if regular compilation works, but
    • you can try deleting the cache directory (it will be regenerated anyway)
    • if you don’t use local packages, the corresponding directory should be empty or not exist, so you can try deleting that too if you don’t use it.

VS Code has an output view: in View, select Output or in the command palette, select View: Toggle Output. Once there, select Tinymist Typst in the dropdown menu, and see if anything looks relevant.

1 Like

Hello! Thanks for your reply.

  • Have you tried restarting VS Code, and your computer?
    Yes, many times. I also reinstalled Tinymist

  • Is there anything in the locations indicated here
    Everything looks fine. There is a cetz package among the files.
    In this location i have this structure:

.
└── typst/
    ├── packages
        └── preview
            └── cetz
                └── 0.4.0
            └── oxifmt
  • I delete directory “typst”. Nothing changed in VS Code. This error remained. Nothing was generated.

  • After that, I used the “typst compile main.typ” command in the terminal again. The directory was generated again.

  • In Output i see nothing useful. Here are the latest messages:

[2025-07-02T15:04:17Z INFO  sync_ls::server] handling textDocument/codeAction - (36)
[2025-07-02T15:04:17Z INFO  tinymist_query::code_action] requested code action: CodeActionRequest { path: "c:\\project\\main.typ", range: Range { start: Position { line: 0, character: 8 }, end: Position { line: 0, character: 29 } }, context: CodeActionContext { diagnostics: [Diagnostic { range: Range { start: Position { line: 0, character: 8 }, end: Position { line: 0, character: 29 } }, severity: Some(Error), code: None, code_description: None, source: Some("typst"), message: "package not found (searched for @preview/cetz:0.4.0)", related_information: None, tags: None, data: None }], only: Some([CodeActionKind("quickfix")]), trigger_kind: Some(Invoked) } }
[2025-07-02T15:04:17Z INFO  sync_ls::server] handled  textDocument/codeAction - (36) in 558.70µs
[Trace - 6:04:17 PM] Received response 'textDocument/codeAction - (36)' in 3ms.
Result: [
    {
        "edit": {
            "changes": {
                "file:///C:/project/main.typ": [
                    {
                        "insertTextFormat": 1,
                        "newText": "\"/@preview/cetz:0.4.0\"",
                        "range": {
                            "end": {
                                "character": 29,
                                "line": 0
                            },
                            "start": {
                                "character": 8,
                                "line": 0
                            }
                        }
                    }
                ]
            }
        },
        "kind": "refactor.rewrite",
        "title": "Convert to absolute path"
    }
]


[Trace - 6:04:26 PM] Sending request 'workspace/executeCommand - (37)'.
Params: {
    "command": "tinymist.focusMain",
    "arguments": [
        null
    ]
}


[2025-07-02T15:04:26Z INFO  sync_ls::server] handling workspace/executeCommand - (37)
[2025-07-02T15:04:26Z INFO  sync_ls::server] handled  workspace/executeCommand - (37) in 25.40µs
[Trace - 6:04:26 PM] Received response 'workspace/executeCommand - (37)' in 2ms.
No result returned.
1 Like

Could you try CeTZ 0.3.4? Is 0.4.0 the only version that does not work, or all versions don’t work?

In addition, could you provide your tinymist version? The latest version is 0.13.14 published 10 days ago. Sometimes VS Code just declares it is latest, but not.

For me this sounds like a permission issue. Which operating system are you using and how did you install VS Code?

  1. All Cetz versions don’t work
  2. Tinymist version on VS Code:
Installation
Identifier myriad-dreamin.tinymist
Version 0.13.14
Last Updated 2025-07-01, 19:15:34
Size 53.54MB

Is there another way to see the version?

  1. Typst version 0.13.1
1 Like

I have Windows 10. I installed VS Code from the official website many years ago. Previously, I successfully worked with Typst in VS Code. The problem appeared yesterday.

1 Like

Weird… Do you receive any completion when typing #import "@pre"?

Yes

Could you provide more Output? There should be a line containing tinymist_query::package

[2025-07-02T16:25:35Z INFO  tinymist_query::package] searching for packages in namespace local in paths ["C:\\Users\\USERNAME\\AppData\\Roaming\\typst/packages", "C:\\Users\\USERNAME\\AppData\\Local\\typst/packages"]

So, if you select cetz among them, you will suddenly get “package not found (searched for @preview/cetz:0.4.0)”?

I have new problem I tried reinstall Tinymist again:

[2025-07-02T16:39:48Z INFO  tinymist] tinymist version information: [["Build Timestamp", "2025-06-22T14:40:18.369346200Z"], ["Build Git Describe", "v0.13.14"], ["Commit SHA", "96510385a13e2005af533ddc1222044704131f6f"], ["Commit Date", "None"], ["Commit Branch", "None"], ["Cargo Target Triple", "x86_64-pc-windows-msvc"], ["Typst Version", "0.13.1"], ["Typst Source", "git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist/v0.13.10#946ea31fb554bcf62e3215f64ddda87d70b026af"]]
[2025-07-02T16:39:48Z INFO  tinymist] starting language server: LspArgs { mirror: MirrorArgs { mirror: "", replay: "" }, font: CompileFontArgs { font_paths: [], ignore_system_fonts: false } }
[2025-07-02T16:39:48Z INFO  sync_ls::server] handling initialize - (0)
[2025-07-02T16:39:48Z INFO  tinymist::config] ServerState: config update_by_map {}
[2025-07-02T16:39:48Z INFO  tinymist::config] ServerState: config update_by_map {"colorTheme":"light","compileStatus":"enable","completion":{"postfix":true,"postfixUfcs":true,"postfixUfcsLeft":true,"postfixUfcsRight":true,"symbol":"step","triggerOnSnippetPlaceholders":true},"configureDefaultWordSeparator":"disable","copyAndPaste":"enable","customizedShowDocument":true,"dragAndDrop":"enable","exportPdf":"never","exportTarget":"paged","formatterIndentSize":2,"formatterMode":"typstyle","formatterPrintWidth":120,"formatterProseWrap":false,"lint":{"enabled":false,"when":"onSave"},"onEnterEvent":true,"outputPath":"","preview":{"cursorIndicator":true,"fontPaths":[],"invertColors":null,"partialRendering":true,"pinPreviewFile":false,"refresh":"onSave","scrollSync":"never","sysInputs":{},"systemFonts":true},"previewFeature":"enable","probedServerPath":"c:\\Users\\Елена\\.vscode\\extensions\\myriad-dreamin.tinymist-0.13.14-win32-x64\\out\\tinymist.exe","projectResolution":"singleFile","renderDocs":"enable","rootPath":"","semanticTokens":"enable","showExportFileIn":null,"statusBarFormat":"{compileStatusIcon} {wordCount} [{fileName}]","supportExtendedCodeAction":true,"supportHtmlInMarkdown":true,"systemFonts":true,"trace":{"server":"verbose"},"triggerParameterHints":true,"triggerSuggest":true,"triggerSuggestAndParameterHints":true,"typingContinueCommentsOnNewline":true,"typstExtraArgs":[]}
[2025-07-02T16:39:48Z INFO  tinymist::server] ServerState: initialized with config Config { const_config: ConstConfig { position_encoding: Utf16, cfg_change_registration: true, notify_will_rename_files: true, tokens_dynamic_registration: true, tokens_overlapping_token_support: false, tokens_multiline_token_support: false, doc_line_folding_only: true, doc_fmt_dynamic_registration: true, locale: Some("en") }, const_dap_config: ConstDapConfig { path_format: Path, lines_start_at1: true, columns_start_at1: true }, customized_show_document: true, has_default_entry_path: false, notify_status: true, support_html_in_markdown: true, extended_code_action: true, color_theme: Some("light"), entry_resolver: EntryResolver { project_resolution: SingleFile, root_path: Some(""), roots: ["c:\\project"], entry: None, typst_toml_cache: {} }, lsp_inputs: {"x-preview": "{\"version\":1,\"theme\":\"light\"}"}, periscope_args: None, typst_extra_args: Some(TypstExtraArgs { root_dir: None, entry: None, inputs: {}, font: CompileFontArgs { font_paths: [], ignore_system_fonts: false }, package: CompilePackageArgs { package_path: None, package_cache_path: None }, features: [], pdf_standard: [], creation_timestamp: None, cert: None }), semantic_tokens: Enable, completion: CompletionFeat { trigger_on_snippet_placeholders: true, trigger_suggest: true, trigger_parameter_hints: true, trigger_suggest_and_parameter_hints: true, symbol: Some(Step), postfix: Some(true), postfix_ufcs: Some(true), postfix_ufcs_left: Some(true), postfix_ufcs_right: Some(true), postfix_snippets: None }, preview: PreviewFeat { browsing: BrowsingPreviewOpts { args: None }, background: BackgroundPreviewOpts { enabled: false, args: None } }, lint: LintFeat { enabled: Some(false), when: Some(OnSave) }, font_opts: CompileFontArgs { font_paths: [], ignore_system_fonts: false }, font_paths: [], fonts: OnceLock(<uninit>), system_fonts: Some(true), export_target: Paged, export_pdf: Never, output_path: PathPattern(""), formatter_mode: Typstyle, formatter_print_width: Some(120), formatter_indent_size: Some(2), formatter_prose_wrap: Some(false), warnings: [] }
[2025-07-02T16:39:48Z INFO  tinymist::project] ServerState: creating ProjectState, entry: EntryState { root: Some(""), main: None }, inputs: {"x-preview": "{\"version\":1,\"theme\":\"light\"}"}
[2025-07-02T16:39:48Z INFO  tinymist::config] creating SharedFontResolver with CompileFontArgs { font_paths: [], ignore_system_fonts: false }
[2025-07-02T16:39:48Z INFO  sync_ls::server] handled  initialize - (0) in 53.50ms
[2025-07-02T16:39:48Z INFO  tinymist_project::watch] NotifyActor: start watching files...
[Trace - 7:39:48 PM] Received response 'initialize - (0)' in 83ms. Request failed: crates\tinymist-project\src\entry.rs:183:17: rootPath or typstExtraArgs.root must be an absolute path: {root:? (-32602).
[Error - 7:39:48 PM] Server initialization failed.
  Message: crates\tinymist-project\src\entry.rs:183:17: rootPath or typstExtraArgs.root must be an absolute path: {root:?
  Code: -32602 
1 Like

Did you set tinymist.rootPath to ""? You could try to revert this config to the default.

Besides, I notice your Windows username contains non-ASCII characters. It could be a problem, but I am not sure…

I reset this setting and the problem “package not found” is back. There is no line that contains “tinymist_query::package”

1 Like