slymnoyann/hey-1 · error · Error

Something went wrong!

Error message

Something went wrong!

What it means

Thrown by handleCreatePost in NewPublication.tsx when getMetadata returns a falsy value. getMetadata assembles the Lens-style publication metadata object (title, content, attachments, media); a null/undefined result means the current combination of post fields (audio post, video without thumbnail, empty content, etc.) doesn't map to any valid metadata type.

Solutions

  1. Inspect composer state right before publish: verify content is non-empty and every attachment has uri + mimeType (this is the same precondition as usePostMetadata.assertUploadedAttachment)
  2. Ensure video posts have a selected thumbnail and a parsed positive duration before enabling the post button
  3. If you added a new media type, extend getMetadata's branching to handle it and return metadata
  4. Catch ERRORS.SomethingWentWrong and show which field is invalid to disambiguate

Example fix

// before
const metadata = getMetadata({ baseMetadata });
if (!metadata) {
  throw new Error(ERRORS.SomethingWentWrong);
}

// after
const metadata = getMetadata({ baseMetadata });
if (!metadata) {
  throw new Error(
    !baseMetadata.content?.trim()
      ? "Post content cannot be empty"
      : !attachments.every((a) => a.uri && a.mimeType)
        ? "Attachments are still uploading"
        : ERRORS.SomethingWentWrong
  );
}
Defensive patterns

Strategy: validation

Validate before calling

const canBuildMetadata =
  Boolean(baseMetadata.content?.trim()) &&
  attachments.every((a) => a.uri && a.mimeType) &&
  (!isVideoPost || (Boolean(videoThumbnail.url) && duration > 0));
if (!canBuildMetadata) {
  // block publish and show field-level feedback instead of calling handleCreatePost
}

Type guard

const hasCompletePost = (p: {
  content?: string;
  attachments: { uri?: string; mimeType?: string }[];
  videoThumbnail?: { url?: string };
}): boolean =>
  Boolean(p.content?.trim()) &&
  p.attachments.every((a) => Boolean(a.uri && a.mimeType));

Try / catch

try {
  await handleCreatePost();
} catch (e) {
  if (e instanceof Error && e.message === ERRORS.SomethingWentWrong) {
    // re-check composer state and highlight the invalid field
  }
}

Prevention

When it happens

Trigger: Publishing with only unsupported attachment types, an audio post missing required fields, a video post where the thumbnail/duration preconditions fail, or an empty/whitespace-only publication so getMetadata can't determine the metadata type and returns undefined.

Common situations: UI state desync where the composer shows a post as ready but the underlying attachment store never finished uploading; a new attachment type added without extending getMetadata's type-matching; editing a legacy post whose stored shape no longer matches any metadata branch.

Related errors


AI-assisted analysis of slymnoyann/hey-1@88c8f9d553 (2026-08-28). Data as JSON: /api/errors/6f936d4ad95a400c. Report an issue: GitHub.

Appendix: source

Thrown at src/components/Composer/NewPublication.tsx:223

      if (!hasValidVideoMetadata) {
        setIsSubmitting(false);
        return setPostContentError(
          "Add a valid video thumbnail before posting."
        );
      }

      setPostContentError("");

      const baseMetadata = {
        content: postContent.length > 0 ? postContent : undefined,
        title: hasAudio
          ? audioPost.title
          : `${getTitlePrefix()} by ${getAccount(currentAccount).username}`
      };

      const metadata = getMetadata({ baseMetadata });
      if (!metadata) {
        throw new Error(ERRORS.SomethingWentWrong);
      }

      const contentUri = await uploadMetadata(metadata);

      if (editingPost) {
        umami.track("edit_post");
        return await editPost({
          variables: { request: { contentUri, post: editingPost?.id } }
        });
      }

      umami.track(isComment ? "comment" : isQuote ? "quote" : "create_post");
      return await createPost({
        variables: {
          request: {
            contentUri,
            ...((feed || selectedFeed) && { feed: feed || selectedFeed }),
            ...(isComment && { commentOn: { post: post?.id } }),

View on GitHub (pinned to 88c8f9d553)