apache/seatunnel · error · MyHoursConnectorException

GET_MYHOURS_TOKEN_FAILE

GET_MYHOURS_TOKEN_FAILE

Error message

Login http client execute exception, http response status code:[%d], content:[%s]

What it means

MyHoursSource.getAccessToken() performs an HTTP login request to the MyHours API and expects an access_token in the JSON response. When the response status code is not successful (or the token field is missing), the connector throws MyHoursConnectorException with code GET_MYHOURS_TOKEN_FAILE including the HTTP status code and response body for diagnosis.

Source

Thrown at seatunnel-connectors-v2/connector-http/connector-http-myhours/src/main/java/org/apache/seatunnel/connectors/seatunnel/myhours/source/MyHoursSource.java:89

        HttpClientProvider loginHttpClient = new HttpClientProvider(myHoursLoginParameter);
        try {

            HttpResponse response =
                    loginHttpClient.execute(
                            this.httpParameter.getUrl(),
                            this.httpParameter.getMethod().getMethod(),
                            this.httpParameter.getHeaders(),
                            this.httpParameter.getParams(),
                            this.httpParameter.getBody(),
                            this.httpParameter.isKeepParamsAsForm());
            if (HttpResponse.STATUS_OK == response.getCode()) {
                String content = response.getContent();
                if (!Strings.isNullOrEmpty(content)) {
                    Map<String, String> contentMap = JsonUtils.toMap(content);
                    return contentMap.get(MyHoursSourceOptions.ACCESS_TOKEN);
                }
            }
            throw new MyHoursConnectorException(
                    MyHoursConnectorErrorCode.GET_MYHOURS_TOKEN_FAILE,
                    String.format(
                            "Login http client execute exception, http response status code:[%d], content:[%s]",
                            response.getCode(), response.getContent()));
        } catch (Exception e) {
            throw new MyHoursConnectorException(
                    MyHoursConnectorErrorCode.GET_MYHOURS_TOKEN_FAILE,
                    "Login http client execute exception");
        } finally {
            try {
                loginHttpClient.close();
            } catch (IOException e) {
                log.warn(e.getMessage(), e);
            }
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the MyHours email and password options in the source config are correct and the account is active.
  2. Inspect the response content in the error message to identify the API-reported reason (invalid credentials, 429, 5xx).
  3. Confirm the MyHours API base URL/endpoint matches the current MyHours API version.
  4. Retry after resolving account lockout or transient API outages.

Example fix

// before
source {
  MyHours {
    url = "https://api.myhours.com"
    email = "wrong@example.com"
    password = "old-password"
  }
}

// after
source {
  MyHours {
    url = "https://api.myhours.com"
    email = "user@example.com"
    password = "current-password"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check credentials outside the pipeline:
curl -s -o /dev/null -w "%{http_code}" -X POST https://api.myhours.com/api/v1/tokens -H 'Content-Type: application/json' -d '{"email":"...","password":"..."}'
// Expect 200; non-2xx means the connector will throw GET_MYHOURS_TOKEN_FAILE.

Try / catch

try {
    runSeaTunnelJob(config);
} catch (MyHoursConnectorException e) {
    if (MyHoursConnectorErrorCode.GET_MYHOURS_TOKEN_FAILE.equals(e.getErrorCode())) {
        log.error("MyHours login failed, check credentials: {}", e.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: POST to the MyHours login endpoint returns a non-2xx status (wrong email/password, locked account, API outage), or returns 2xx with a body lacking the ACCESS_TOKEN field; the exception is built from response.getCode() and response.getContent().

Common situations: Incorrect or expired MyHours credentials in config (api_email/api_password), MyHours API endpoint/base-url misconfiguration, account rate limiting, or the API returning an error JSON instead of a token.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/0807c6d0a7aa4373. Report an issue: GitHub.