Invalid file format for JS, works in GPTs, fails in Assistant-create UI

I am attempting to upload this javascript file for use by an Assistant.

This is an es6 javascript file which includes multiple exports and some typedefs. It uploads without issue in the GPT builder, but gives the Invalid file format error when attempting to upload it in the Create an Assistant UI.

I’ve narrowed it down to having something to do with importing functions and exporting specific content from a function - but can’t quite see what the pattern is. Below are examples of the actual content of a file I’ve tested this with

this uploads:

import { someExport } from './some-file.js';

function testFunc(content = {}) {

  return '<a href="${content.url}"></a>';
}

export default testFunc;

this fails:

import { someExport } from './some-file.js';

function testFunc(content = {}) {

  return 'thing';
}

export default testFunc;

but this uploads without error (no import):

function testFunc(content = {}) {

  return 'thing';
}

export default testFunc;

thank you

1 Like

Tested this locally using the Assistant API and seeing the same issue. Error:

BadRequestError: 400 Invalid file format. Supported formats: ['c', 'cpp', 'csv', 'docx', 'html', 'java', 'json', 'md', 'pdf', 'php', 'pptx', 'py', 'rb', 'tex', 'txt', 'css', 'jpeg', 'jpg', 'js', 'gif', 'png', 'tar', 'ts', 'xlsx', 'xml', 'zip']
    at APIError.generate (file:///Users/path/to/node_modules/openai/error.mjs:39:20)
    at OpenAI.makeStatusError (file:///Users/path/to/node_modules/openai/core.mjs:244:25)
    at OpenAI.makeRequest (file:///Users/path/to/node_modules/openai/core.mjs:283:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async uploadFileTest (file:///Users/path/to/assistant-tester.js:108:16) {
  status: 400,
  headers: {
    'access-control-allow-origin': '*',
    'alt-svc': 'h3=":443"; ma=86400',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '82421b259ff2430e-EWR',
    connection: 'keep-alive',
    'content-length': '335',
    'content-type': 'application/json',
    date: 'Fri, 10 Nov 2023 23:34:25 GMT',
    'openai-organization': 'user-pquv3xzxl3kst64yrueogrh0',
    'openai-processing-ms': '86',
    'openai-version': '2020-10-01',
    server: 'cloudflare',
    'set-cookie': '__cf_bm=kOdsE.L1aaILHXvMSlGG.zcVYRmqItKXD5_ANujzzAA-1699659265-0-AW21gOyl7pdePfY+4az8PkZBZPRGujkNy4LvORcuRKlNnmvKMs6JAd31cZidGsDNSalUiIw3o8xW9Va7QQhlMeY=; path=/; expires=Sat, 11-Nov-23 00:04:25 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None',
    'strict-transport-security': 'max-age=15724800; includeSubDomains',
    'x-request-id': 'e3e156f97b0fcaf66a00bbb4c7ebbf8b'
  },
  error: {
    message: "Invalid file format. Supported formats: ['c', 'cpp', 'csv', 'docx', 'html', 'java', 'json', 'md', 'pdf', 'php', 'pptx', 'py', 'rb', 'tex', 'txt', 'css', 'jpeg', 'jpg', 'js', 'gif', 'png', 'tar', 'ts', 'xlsx', 'xml', 'zip']",
    type: 'invalid_request_error',
    param: null,
    code: null
  },
  code: null,
  param: null,
  type: 'invalid_request_error'
}

I am having the same issue. Both the create UI and through the API, I am receiving the same Invalid File Format error. I have tested .md, .txt and .php files and they are all getting the same error.

We have the same problem here unfortunately (just with typescript files)

We have same problem. I can’ seem to be able to upload .json file

Find you a solution for this? I have the same Problem. Some import statements working, others not. Some files without import also not working. :disguised_face: it‘s really strange.