{"record":{"id":"a140ead21360f562","repo":"slimtoolkit/slim","slug":"sensor-artifact-getnuxtconfig-error-getting-d","errorCode":null,"errorMessage":"sensor: artifact - getNuxtConfig - error getting distDir => %s","messagePattern":"sensor: artifact - getNuxtConfig - error getting distDir => (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/sensor/artifact/artifact.go","lineNumber":3056,"sourceCode":"\t\t\tif v, err := value.ToString(); err == nil {\n\t\t\t\tnuxt.Build = v\n\t\t\t} else {\n\t\t\t\tlog.Debugf(\"saveArtifacts - using build default => %s\", err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Debug(\"saveArtifacts - error reading nuxt.config.js file => \", err.Error())\n\t\t\treturn nil, fmt.Errorf(\"sensor: artifact - getNuxtConfig - error getting buildDir => %s\", path)\n\t\t}\n\n\t\tif value, err := vm.Get(nuxtDistDirKey); err == nil {\n\t\t\tif v, err := value.ToString(); err == nil {\n\t\t\t\tnuxt.Dist = fmt.Sprintf(\"%s/%s\", nuxt.Build, v)\n\t\t\t} else {\n\t\t\t\tlog.Debugf(\"saveArtifacts - using dist default => %s\", err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Debug(\"saveArtifacts - reading nuxt.config.js file => \", err.Error())\n\t\t\treturn nil, fmt.Errorf(\"sensor: artifact - getNuxtConfig - error getting distDir => %s\", path)\n\t\t}\n\t*/\n\n\treturn &nuxt, nil\n}\n\nfunc isNuxtConfigFile(filePath string) bool {\n\tfileName := filepath.Base(filePath)\n\tif fileName == nuxtConfigFile {\n\t\treturn true\n\t}\n\n\t//TODO: read the file and verify that it's a real nuxt config file\n\treturn false\n}\n\n/////\n","sourceCodeStart":3038,"sourceCodeEnd":3074,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/sensor/artifact/artifact.go#L3038-L3074","documentation":"Similarly to the buildDir extraction, getNuxtConfig queries the evaluated config VM for the dist directory key (nuxtDistDirKey). If vm.Get for that key errors, the function returns this error naming the config path. The distDir property could not be extracted from the evaluated nuxt.config.","triggerScenarios":"vm.Get(nuxtDistDirKey) returns an error while extracting dist from the evaluated nuxt.config.js — the config failed to fully evaluate or the dist property access itself threw inside the VM.","commonSituations":"Config with getters/complex expressions around the dist property; partial VM evaluation failure after the buildDir step succeeded; Nuxt version where dist configuration moved (e.g. generated.dir) so the expected key path is invalid.","solutions":["Check the debug log ('reading nuxt.config.js file') for the VM's dist extraction error.","Confirm the Nuxt version and where it defines the dist directory; adjust the key path (nuxtDistDirKey) accordingly.","Simplify the config's dist expression to a plain string the VM can return.","Use the regex/AST fallback on the raw config text if VM extraction keeps failing."],"exampleFix":"// before\nreturn nil, fmt.Errorf(\"sensor: artifact - getNuxtConfig - error getting distDir => %s\", path)\n// after\nvalue, err := vm.Get(nuxtDistDirKey)\nif err != nil {\n    log.Debugf(\"dist key lookup failed (%s), using default dist dir\", err)\n    nuxt.Dist = fmt.Sprintf(\"%s/%s\", nuxt.Build, nuxtDefaultDistDir) // fall back to default\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"nuxt, err := getNuxtConfig(configPath)\nif err != nil {\n    if strings.Contains(err.Error(), \"error getting distDir\") {\n        log.Warnf(\"could not read distDir from config; falling back to buildDir/dist\")\n        return useDefaultNuxtDirs(configPath)\n    }\n    return err\n}","preventionTips":["Define dist as a plain string property in nuxt.config","Update nuxtDistDirKey when upgrading Nuxt versions that moved the setting","Fall back to the default dist directory instead of failing artifact extraction"],"tags":["nuxt","javascript","vm-evaluation","config-parsing"],"backgroundTag":"config-parse-failed","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}