siyuan-note/siyuan · warning

Conf.Language(294)

Error message

Conf.Language(294)

What it means

Conf.Language(294) is the localized message shown when an activation code is empty. UseActivationcode rejects the request before any network call because after stripping invalid characters and trimming whitespace the submitted code is the empty string.

Solutions

  1. Provide a non-empty activation code in the request body and retry
  2. Check the UI input for whitespace-only values and show a validation message before calling the kernel API
  3. Re-copy the activation code from the purchase email/marketplace, ensuring no placeholder text or only invisible characters were selected

Example fix

// before
await fetchPost("/api/attr/useActivationcode", {code: codeInput.value});
// after
if (!codeInput.value.trim()) { showMessage(window.siyuan.languages["_kernel"]["294"]); return; }
await fetchPost("/api/attr/useActivationcode", {code: codeInput.value.trim()});
Defensive patterns

Strategy: validation

Validate before calling

const code = (codeInput?.value ?? "").trim();
if (!code) { showMessage(window.siyuan.languages["_kernel"]["294"]); return; }

Type guard

const hasCode = (v) => typeof v === "string" && v.trim().length > 0;

Try / catch

try {
  const res = await fetchSyncPost("/api/attr/useActivationcode", {code});
  if (res.code !== 0) showMessage(res.msg);
} catch (e) { showMessage(e.message); }

Prevention

When it happens

Trigger: Calling model.UseActivationcode(code) (kernel/model/cloud_service.go:745) with an empty string, a string of only whitespace, or a string containing only characters removed by util.RemoveInvalid — e.g. the API consumer submitted the redemption form without filling in the code field.

Common situations: A frontend dialog submits an empty activation-code input; a script automating subscription redemption passes an unset/blank variable; a copied 'code' contained only formatting characters that RemoveInvalid strips.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/79b866910c7edd96. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/cloud_service.go:745

		logging.LogErrorf("get community user failed: %s", result["msg"])
		return nil, errRequestUserFailed
	}

	dataStr := result["data"].(string)
	data := util.AESDecrypt(dataStr)
	user := &conf.User{}
	if err = gulu.JSON.UnmarshalJSON(data, &user); err != nil {
		logging.LogErrorf("get community user failed: %s", err)
		return nil, errRequestUserFailed
	}
	return user, nil
}

func UseActivationcode(code string) (err error) {
	code = util.RemoveInvalid(code)
	code = strings.TrimSpace(code)
	if "" == code {
		return errors.New(Conf.Language(294))
	}
	user := Conf.GetUser()
	if user == nil {
		return errors.New(Conf.Language(31))
	}
	invalidUser := cloudAccountAuthFailureHandler(user.UserToken)
	requestResult := gulu.Ret.NewResult()
	request := httpclient.NewCloudRequest30s()
	resp, err := request.
		SetSuccessResult(requestResult).
		SetBody(map[string]string{"data": code}).
		SetCookies(&http.Cookie{Name: "symphony", Value: user.UserToken}).
		Post(util.GetCloudServer() + "/apis/siyuan/useActivationcode")
	if err != nil {
		logging.LogErrorf("check activation code failed: %s", err)
		return ErrFailedToConnectCloudServer
	}
	if http.StatusUnauthorized == resp.StatusCode {

View on GitHub (pinned to 9f775e8a12)