Skip to content

Video upload not working, request status 400 #1115

@clienthold

Description

@clienthold

Steps to reproduce

My code:

import { readFileSync, writeFileSync, existsSync } from "fs";
import { Innertube, UniversalCache } from "youtubei.js";

const creds_path = "./my_yt_creds.json";
const creds = existsSync(creds_path) ? JSON.parse(readFileSync(creds_path).toString()) : undefined;

(async () => {
    const yt = await Innertube.create({ cache: new UniversalCache(false) });
    await yt.session.signIn(creds);
    
    const file = readFileSync("./test.mp4");
    
    const upload = await yt.studio.upload(file.buffer, {
        title: "Wow!",
        description: new Date().toString(),
        privacy: "UNLISTED"
    });

    console.info("Done!", upload);
})();

Failure Logs

InnertubeError: Request to https://www.youtube.com/youtubei/v1/upload/createvideo?prettyPrint=false&alt=json failed with status code 400
    at HTTPClient.fetch (file:///C:/Users/root/Downloads/uploader/node_modules/youtubei.js/dist/src/utils/HTTPClient.js:94:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    at async Actions.execute (file:///C:/Users/root/Downloads/uploader/node_modules/youtubei.js/dist/src/core/Actions.js:65:26)
    at async #setVideoMetadata (file:///C:/Users/root/Downloads/uploader/node_modules/youtubei.js/dist/src/core/clients/Studio.js:171:16)
    at async Studio.upload (file:///C:/Users/root/Downloads/uploader/node_modules/youtubei.js/dist/src/core/clients/Studio.js:123:16)
    at async file:///C:/Users/root/Downloads/uploader/yt_test.mjs:13:20 {
  date: 2026-01-14T04:03:52.559Z,
  version: '16.0.1',
  info: '{\n' +
    '  "error": {\n' +
    '    "code": 400,\n' +
    '    "message": "Request contains an invalid argument.",\n' +
    '    "errors": [\n' +
    '      {\n' +
    '        "message": "Request contains an invalid argument.",\n' +
    '        "domain": "global",\n' +
    '        "reason": "badRequest"\n' +
    '      }\n' +
    '    ],\n' +
    '    "status": "INVALID_ARGUMENT"\n' +
    '  }\n' +
    '}\n'
}

Expected behavior

The video should have been uploaded to YouTube

Current behavior

Error 400 in response to https://www.youtube.com/youtubei/v1/upload/createvideo?prettyPrint=false&alt=json

Version

Default

Anything else?

No response

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions