ToolJet/ToolJet · error · QueryError
Query could not be completed
Error message
Query could not be completed
What it means
Thrown by Fedex.generateOAuthToken after a successful HTTP call to ${base_url}/oauth/token whose JSON body lacks an access_token field. FedEx returned a 2xx response but the body did not contain a usable token, so the plugin refuses to proceed. The error's `.data` carries the statusCode, statusMessage, and the full response body (`errors`) for diagnosis.
Source
Thrown at marketplace/plugins/fedex/lib/index.ts:115
formData['child_key'] = child_key;
formData['child_secret'] = child_secret;
} else if (customer_type === CustomerType.PROPRIETARY_PARENT_CHILD) {
// Proprietary Parent-Child Customers flow
formData['grant_type'] = 'client_pc_credentials';
formData['child_key'] = child_key;
formData['child_secret'] = child_secret;
}
try {
const response = await got.post(tokenUrl, {
form: formData,
responseType: 'json',
});
const data = response.body as any;
if (!data.access_token) {
throw new QueryError('Query could not be completed', 'Access token missing in response', {
status: response.statusCode,
statusMessage: response.statusMessage,
errors: data,
});
}
return {
accessToken: data.access_token,
expiresIn: data.expires_in,
};
} catch (error) {
if (error instanceof QueryError) {
throw error;
}
throw this.parseHttpError(error, 'Failed to obtain OAuth token from FedEx');
}
}View on GitHub (pinned to 20602a8e10)
Solutions
- Inspect err.data.errors to read FedEx's actual reason from the response body.
- Verify client_id and client_secret are still active in the FedEx Developer Console for the target environment.
- Ensure the customer_type selection matches the OAuth client type configured in FedEx (standard vs internal vs proprietary parent-child).
- Confirm base_url matches the environment the credentials were issued for (sandbox vs production).
- Re-issue credentials in the FedEx Developer Console if they were revoked, then re-run the query.
Defensive patterns
Strategy: validation
Validate before calling
// Validate that credentials are plausible before letting generateOAuthToken call FedEx.
function assertFedexCreds(s: SourceOptions) {
if (!s.client_id || !s.client_secret) throw new Error('FedEx client_id/client_secret required');
if (s.customer_type && s.customer_type !== 'standard_customers' && (!s.child_key || !s.child_secret)) {
throw new Error('child_key/child_secret required for ' + s.customer_type);
}
}
await assertFedexCreds(sourceOptions); Type guard
function hasAccessToken(body: unknown): body is { access_token: string } {
return typeof (body as any)?.access_token === 'string' && (body as any).access_token.length > 0;
}
// if (!hasAccessToken(data)) { /* handle before the plugin throws */ } Try / catch
try {
await fedex.run(sourceOptions, queryOptions, dataSourceId);
} catch (err) {
if (err?.data?.errors) console.error('FedEx token error body:', err.data.errors);
throw err;
} Prevention
- Keep credentials active in the FedEx Developer Console; rotate before expiry.
- Match customer_type to the OAuth client type configured in FedEx.
- Use sandbox credentials only with the sandbox base_url.
- Log err.data.errors to capture FedEx's exact rejection reason.
When it happens
Trigger: FedEx returns 200 with a body like {"error":"invalid_client"} and no access_token; client_id/client_secret are well-formed but revoked or disabled; grant_type does not match the customer_type configured in FedEx Developer Console; sandbox credentials sent to the production base_url.
Common situations: Credentials disabled or rotated in the FedEx Developer Console after initial setup; customer_type changed in the datasource but the OAuth client in FedEx was not reconfigured; environment drift between sandbox and production credentials.
Related errors
- err.description || err.message
- ${displayMessage}
- Could not connect to Googlesheets
- Authentication required
- ${googleMessage}
AI-assisted analysis of ToolJet/ToolJet@20602a8e10 (2026-08-13).
Data as JSON: /api/errors/65d2c0660cdb0c08.
Report an issue: GitHub.