transloadit/uppy · error
res.sendStatus(400)
Error message
res.sendStatus(400)
What it means
The Companion search controller returns HTTP 400 when no provider handler is attached to the request (req.companion.provider is falsy). This means the route was hit for a providerName that Companion could not instantiate or does not have enabled, so it cannot forward the search request.
Source
Thrown at packages/@uppy/companion/src/server/controllers/search.ts:12
import type { NextFunction, Request, Response } from 'express'
import { respondWithError } from '../provider/error.js'
export default async function search(
req: Request,
res: Response,
next: NextFunction,
): Promise<void> {
const { query, companion } = req
const { providerUserSession, provider } = companion
if (!provider) {
res.sendStatus(400)
return
}
const buildURL = companion.buildURL
const q = query['q']
if (buildURL == null || typeof q !== 'string') {
res.sendStatus(500)
return
}
try {
const data = await provider.search({
companion: { buildURL },
providerUserSession,
query: { ...query, q },
})
res.json(data)
} catch (err) {View on GitHub (pinned to 5d4dedd02a)
Solutions
- Verify the providerName in the URL matches an enabled provider (e.g. 'unsplash', 'drive')
- Check companion options: provider must be listed and have valid credentials
- Inspect logs for 'provider.middleware.invalid' / 'invalid provider options detected' warnings at startup
- Ensure the request goes through the full Companion middleware chain (not hitting the controller directly)
Example fix
// before
companionOptions: { providerOptions: {} } // no credentials
// after
companionOptions: { providerOptions: { unsplash: { key: process.env.UNSPLASH_KEY, secret: process.env.UNSPLASH_SECRET } } } Defensive patterns
Strategy: validation
Validate before calling
const enabled = await fetch(`${companionUrl}/`).then(r => r.json());
if (!enabled.some(p => p.providerName === name)) throw new Error('provider not enabled') Type guard
const isEnabledProvider = (name: string, providers: {providerName: string}[]) => providers.some(p => p.providerName === name) Prevention
- Check Companion's index route for enabled providers before using one
- Configure all provider credentials at startup
When it happens
Trigger: Calling GET /search/:providerName?q=... where the provider middleware failed to attach req.companion.provider (unknown/disabled/unconfigured provider, e.g. missing credentials, or provider options invalid so it was not loaded).
Common situations: Requesting search on a non-search-capable provider, typo in providerName, provider disabled in companion options, or invalid provider options causing the provider middleware to skip loading.
Related errors
- Missing S3 object key for aborting upload
- Missing S3 object key for resuming upload
- Missing S3 object key for uploading part
- companionEndpoint must be a string
- s3Endpoint must be a string
AI-assisted analysis of transloadit/uppy@5d4dedd02a (2026-08-28).
Data as JSON: /api/errors/92168887e178e9ec.
Report an issue: GitHub.