slimtoolkit/slim · error

sensor: artifact - getNuxtConfig - error getting distDir =>

Error message

sensor: artifact - getNuxtConfig - error getting distDir => %s

What it means

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.

Source

Thrown at pkg/app/sensor/artifact/artifact.go:3056

			if v, err := value.ToString(); err == nil {
				nuxt.Build = v
			} else {
				log.Debugf("saveArtifacts - using build default => %s", err.Error())
			}
		} else {
			log.Debug("saveArtifacts - error reading nuxt.config.js file => ", err.Error())
			return nil, fmt.Errorf("sensor: artifact - getNuxtConfig - error getting buildDir => %s", path)
		}

		if value, err := vm.Get(nuxtDistDirKey); err == nil {
			if v, err := value.ToString(); err == nil {
				nuxt.Dist = fmt.Sprintf("%s/%s", nuxt.Build, v)
			} else {
				log.Debugf("saveArtifacts - using dist default => %s", err.Error())
			}
		} else {
			log.Debug("saveArtifacts - reading nuxt.config.js file => ", err.Error())
			return nil, fmt.Errorf("sensor: artifact - getNuxtConfig - error getting distDir => %s", path)
		}
	*/

	return &nuxt, nil
}

func isNuxtConfigFile(filePath string) bool {
	fileName := filepath.Base(filePath)
	if fileName == nuxtConfigFile {
		return true
	}

	//TODO: read the file and verify that it's a real nuxt config file
	return false
}

/////

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Check the debug log ('reading nuxt.config.js file') for the VM's dist extraction error.
  2. Confirm the Nuxt version and where it defines the dist directory; adjust the key path (nuxtDistDirKey) accordingly.
  3. Simplify the config's dist expression to a plain string the VM can return.
  4. Use the regex/AST fallback on the raw config text if VM extraction keeps failing.

Example fix

// before
return nil, fmt.Errorf("sensor: artifact - getNuxtConfig - error getting distDir => %s", path)
// after
value, err := vm.Get(nuxtDistDirKey)
if err != nil {
    log.Debugf("dist key lookup failed (%s), using default dist dir", err)
    nuxt.Dist = fmt.Sprintf("%s/%s", nuxt.Build, nuxtDefaultDistDir) // fall back to default
}
Defensive patterns

Strategy: fallback

Try / catch

nuxt, err := getNuxtConfig(configPath)
if err != nil {
    if strings.Contains(err.Error(), "error getting distDir") {
        log.Warnf("could not read distDir from config; falling back to buildDir/dist")
        return useDefaultNuxtDirs(configPath)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/a140ead21360f562. Report an issue: GitHub.