projectdiscovery/nuclei · error

error getting database name from connection string

Error message

error getting database name from connection string

What it means

Error "error getting database name from connection string" thrown in projectdiscovery/nuclei.

Source

Thrown at pkg/reporting/exporters/mongo/mongo.go:82

	// Ensure the connection is valid
	err = client.Ping(context.Background(), nil)
	if err != nil {
		gologger.Error().Msgf("Error connecting to MongoDB: %s", err)
		return nil, err
	}

	// Get the database from the connection string to set the database and collection
	parsed, err := url.Parse(options.ConnectionString)
	if err != nil {
		gologger.Error().Msgf("Error parsing connection string: %s", options.ConnectionString)
		return nil, err
	}

	databaseName := strings.TrimPrefix(parsed.Path, "/")

	if databaseName == "" {
		return nil, errors.New("error getting database name from connection string")
	}

	exporter.connection = client
	exporter.collection = client.Database(databaseName).Collection(options.CollectionName)

	return exporter, nil
}

// Export writes a result document to the configured MongoDB collection
// in the database configured by the connection string
func (exporter *Exporter) Export(event *output.ResultEvent) error {
	exporter.mutex.Lock()
	defer exporter.mutex.Unlock()

	if exporter.options.OmitRaw {
		event.Request = ""
		event.Response = ""
	}

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at pkg/reporting/exporters/mongo/mongo.go:82 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/5f7708b7d9fc79c5. Report an issue: GitHub.