beego/beego · error

key is empty

Error message

key is empty

What it means

Error "key is empty" thrown in beego/beego.

Source

Thrown at core/config/yaml/yaml.go:322

	return err
}

// Set writes a new value for key.
func (c *ConfigContainer) Set(key, val string) error {
	c.Lock()
	defer c.Unlock()
	c.data[key] = val
	return nil
}

// DIY returns the raw value by a given key.
func (c *ConfigContainer) DIY(key string) (v interface{}, err error) {
	return c.getData(key)
}

func (c *ConfigContainer) getData(key string) (interface{}, error) {
	if key == "" {
		return nil, errors.New("key is empty")
	}
	c.RLock()
	defer c.RUnlock()

	keys := strings.Split(key, ".")
	tmpData := c.data
	for idx, k := range keys {
		if v, ok := tmpData[k]; ok {
			switch val := v.(type) {
			case map[string]interface{}:
				tmpData = val
				if idx == len(keys)-1 {
					return tmpData, nil
				}
			default:
				return v, nil
			}
		}

View on GitHub (pinned to 939cfde380)

When it happens

Trigger: Thrown at core/config/yaml/yaml.go:322 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of beego/beego@939cfde380 (2026-08-15). Data as JSON: /api/errors/318345b9ab1434a5. Report an issue: GitHub.