chenhg5/cc-connect · error

webex: createDevice status %d

Error message

webex: createDevice status %d

What it means

The WDM (Webex Device Management) device registration POST returned an unexpected HTTP status. This guard fires after the request completed; a known cause of 400 is omitting required fields (name/model/localizedModel are mandatory, as noted in the comment), while 401 indicates a bad token.

Source

Thrown at platform/webex/client.go:143

	}
	var p person
	if err := json.NewDecoder(resp.Body).Decode(&p); err != nil {
		return nil, err
	}
	return &p, nil
}

func (c *httpClient) CreateDevice(ctx context.Context) (*device, error) {
	// The WDM device endpoint requires name + model + localizedModel; omitting
	// model returns HTTP 400 "Missing Model". Verified against the live API.
	payload := []byte(`{"deviceName":"cc-connect","name":"cc-connect","model":"cc-connect","localizedModel":"cc-connect","systemName":"cc-connect","systemVersion":"1.0","deviceType":"DESKTOP"}`)
	resp, err := c.doWithRetry(ctx, http.MethodPost, "https://wdm-a.wbx2.com/wdm/api/v1/devices", payload, "application/json", "webex: createDevice")
	if err != nil {
		return nil, err
	}
	defer func() { _ = resp.Body.Close() }()
	if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
		return nil, fmt.Errorf("webex: createDevice status %d", resp.StatusCode)
	}
	var d device
	if err := json.NewDecoder(resp.Body).Decode(&d); err != nil {
		return nil, err
	}
	return &d, nil
}

func (c *httpClient) DeleteDevice(ctx context.Context, deviceURL string) error {
	if deviceURL == "" {
		return nil
	}
	resp, err := c.doWithRetry(ctx, http.MethodDelete, deviceURL, nil, "", "webex: deleteDevice")
	if err != nil {
		return err
	}
	defer func() { _ = resp.Body.Close() }()
	if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusAccepted {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. For 400, ensure the payload includes deviceName, name, model, localizedModel, systemName, systemVersion and deviceType as the code does
  2. For 401/403, check the bot token and WDM access rights
  3. Log the response body to surface the WDM error detail
  4. Retry on 5xx with backoff at the caller level
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at platform/webex/client.go:143 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/5af7bf7c863ec533. Report an issue: GitHub.